-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Version
4.5.10
Context
There appears to be a regression of #3249 . When the connection is closed in the connection handler, the request continues to be dispatched to the request handlers.
Do you have a reproducer?
package com.example.starter;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
public class MainVerticle extends AbstractVerticle {
@Override
public void start(Promise<Void> startPromise) throws Exception {
HttpServer server = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route()
.handler(ctx -> {
System.out.println("!!!!!!!!!!!!! REQUEST HANDLER");
ctx.response()
.putHeader("content-type", "text/plain")
.end("Hello world");
});
server
.connectionHandler(conn -> {
conn.close().onSuccess(v -> System.out.println("------ CONNECTION CLOSED -----"));
})
.requestHandler(router)
.listen(8888).onComplete(http -> {
if (http.succeeded()) {
startPromise.complete();
System.out.println("HTTP server started on port 8888");
} else {
startPromise.fail(http.cause());
}
});
}
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new MainVerticle());
}
}
Steps to reproduce
- Run the above code
- Send a request to http://localhost:8888
- See that even when the
CONNECTION CLOSEDmessage appears, theREQUEST HANDLERmessage also appears
Extra
Linux Fedora 40
java -version
openjdk version "17.0.9" 2023-10-17
IBM Semeru Runtime Open Edition 17.0.9.0 (build 17.0.9+9)
Eclipse OpenJ9 VM 17.0.9.0 (build openj9-0.41.0, JRE 17 Linux amd64-64-Bit Compressed References 20231017_614 (JIT enabled, AOT enabled)
OpenJ9 - 461bf3c70
OMR - 5eee6ad9d
JCL - 3699725139c based on jdk-17.0.9+9)
Reactions are currently unavailable