public class SampleBlockingVerticle extends AbstractVerticle {
protected static final StaticHandler staticHandler = StaticHandler.create("web-app");
@Override
public void start() throws Exception {
Router router = Router.router(vertx);
router.route().blockingHandler(context -> {
try {
Thread.sleep(5000);
staticHandler.handle(context);
} catch (Exception ignore) {}
}, false);
vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
}
If I close the browser within the request execution timeframe (i.e. without waiting for the response to come back) I get this stacktrace:
java.lang.NullPointerException
at io.vertx.core.http.impl.HttpServerResponseImpl.doSendFile(HttpServerResponseImpl.java:491)
at io.vertx.core.http.impl.HttpServerResponseImpl.sendFile(HttpServerResponseImpl.java:342)
at io.vertx.core.http.HttpServerResponse.sendFile(HttpServerResponse.java:317)
at io.vertx.core.http.HttpServerResponse.sendFile(HttpServerResponse.java:303)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.lambda$sendFile$6(StaticHandlerImpl.java:386)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.wrapInTCCLSwitch(StaticHandlerImpl.java:229)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.sendFile(StaticHandlerImpl.java:375)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.lambda$sendStatic$0(StaticHandlerImpl.java:192)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.getFileProps(StaticHandlerImpl.java:275)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.sendStatic(StaticHandlerImpl.java:182)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.handle(StaticHandlerImpl.java:143)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.handle(StaticHandlerImpl.java:52)
at vip.vertx.app.SampleBlockingVerticle.lambda$0(SampleBlockingVerticle.java:22)
at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:259)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
channelFuture = conn.writeToChannel(LastHttpContent.EMPTY_LAST_CONTENT);
written = true;
if (resultHandler != null) {
ContextImpl ctx = vertx.getOrCreateContext();
if (channelFuture != null) {
channelFuture.addListener(future -> {
AsyncResult<Void> res;
if (future.isSuccess()) {
res = Future.succeededFuture();
} else {
res = Future.failedFuture(future.cause());
}
ctx.runOnContext((v) -> resultHandler.handle(res));
});
} else {
resultHandler.handle(Future.failedFuture(new VertxException("channel has been closed by the client!")));
}
}
Could someone please take a look at this and eventually escalate the problem?
Regards,
Mihail
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c2f3966f-3fcd-4fd4-864e-561c0b490e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.