You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say we do something like this on HTTP server side with new HTTP request:
HttpServerserver = vertx.createHttpServer(newHttpServerOptions().setTcpKeepAlive(true));
server.requestHandler(request -> {
varn = 100;
varchunk = newbyte[512 * 1024];
request.response()
.putHeader("content-length", Integer.toString(n * chunk.length))
.putHeader("content-type", "text/plain");
for (inti = 0; i < n; i++) {
request.response().write(Buffer.buffer(chunk));
}
// install exceptionHandler with expectation this will callback once server or client close connectionrequest.response().exceptionHandler(e -> {
LOGGER.info("exceptionHandler()");
});
// close the connection after 2s (as demonstration)vertx.setTimer(2000, unused -> {
LOGGER.info("connection().close()");
request.connection().close();
});
});
On client side, we read few bytes and then go idle, not consuming body but holding on connection. The client not accepting any data is critical piece here.
In Vert.x 3.x, the exceptionHandler() was triggered directly after server forcibly abort the request with request.connection().close().
However in Vert.x 4.x, we can see exceptionHandler() is triggered only after the client disconnects.
I found out that exceptionHandler() is not being called in Vert.x only if n is larger, so that some of write()s are pending in internal Vert.x queue – pending writes seems to block the effect of request.connection().close().
Is this expected? Is there other way to force close connection on server side? Thanks.
The text was updated successfully, but these errors were encountered:
I found out it that ((Http1xServerConnection) request.connection()).channelHandlerContext().close(); seems to do what request.connection().close() used to do in Vert.x 3
Say we do something like this on HTTP server side with new HTTP request:
On client side, we read few bytes and then go idle, not consuming body but holding on connection. The client not accepting any data is critical piece here.
In Vert.x 3.x, the
exceptionHandler()
was triggered directly after server forcibly abort the request withrequest.connection().close()
.However in Vert.x 4.x, we can see
exceptionHandler()
is triggered only after the client disconnects.I found out that
exceptionHandler()
is not being called in Vert.x only ifn
is larger, so that some ofwrite()
s are pending in internal Vert.x queue – pending writes seems to block the effect ofrequest.connection().close()
.Is this expected? Is there other way to force close connection on server side? Thanks.
The text was updated successfully, but these errors were encountered: