vert-x3 / issues

Apache License 2.0
37 stars 7 forks source link

Tests sometimes failing with NullPointerException after 2 minutes. #324

Open LaurentBERTHOLLE opened 6 years ago

LaurentBERTHOLLE commented 6 years ago

public class GetCreativeHandlerIT { private Vertx vertx;

@Before
public void before(TestContext context) {
    vertx = Vertx.vertx();
    vertx.deployVerticle(new HttpServerVerticle(), context.asyncAssertSuccess());
}

@After
public void after(TestContext context) {
    vertx.close(context.asyncAssertSuccess());
}

@Test
public void test1(TestContext context) {
    WebClient client = WebClient.create(vertx);
    Async async = context.async();

    client.get(8080, "localhost", "/foo/index.html")
            .addQueryParam("bar", "")
            .send(ar -> {
                context.assertEquals(200, ar.result().statusCode());
                client.close();
                async.complete();
            });
    async.awaitSuccess();
}

@Test
public void test2(TestContext context) {
    WebClient client = WebClient.create(vertx);
    Async async = context.async();

    client.get(8080, "localhost", "/bar/index.html")
            .send(ar -> {
                context.assertEquals(400, ar.result().statusCode());
                client.close();
                async.complete();
            });
    async.awaitSuccess();
}

When these tests run several times, it sometimes fail with a NullPointerException after 2 minutes. Here is the stacktrace: Jan 23, 2018 11:19:05 AM io.vertx.core.impl.ContextImpl SEVERE: Unhandled exception java.lang.NullPointerException at com.qwe.dcl.handler.GetCreativeHandlerIT.lambda$shouldReturnOkBecauseClickUrlIsEmpty$0(GetCreativeHandlerIT.java:47) at io.vertx.ext.web.client.impl.HttpRequestImpl.lambda$send$7(HttpRequestImpl.java:272) at io.vertx.core.impl.FutureImpl.tryFail(FutureImpl.java:170) at io.vertx.core.impl.FutureImpl.fail(FutureImpl.java:102) at io.vertx.ext.web.client.impl.HttpRequestImpl.lambda$send$9(HttpRequestImpl.java:309) at io.vertx.core.http.impl.HttpClientRequestBase.handleException(HttpClientRequestBase.java:136) at io.vertx.core.http.impl.HttpClientRequestImpl.handleException(HttpClientRequestImpl.java:51) at io.vertx.core.http.impl.HttpClientRequestImpl$2.handleFailure(HttpClientRequestImpl.java:705) at io.vertx.core.http.impl.ConnectionManager$ConnQueue.lambda$connectionFailed$3(ConnectionManager.java:379) at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:335) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:193) at io.vertx.core.http.impl.ConnectionManager$ConnQueue.connectionFailed(ConnectionManager.java:373) at io.vertx.core.http.impl.ConnectionManager$ConnQueue.access$1600(ConnectionManager.java:197) at io.vertx.core.http.impl.ConnectionManager$ChannelConnector.lambda$connect$2(ConnectionManager.java:549) at io.vertx.core.net.impl.ChannelProvider.lambda$connect$0(ChannelProvider.java:42) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507) at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:500) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:479) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:420) at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:327) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:343) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:630) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:565) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:479) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) at java.lang.Thread.run(Thread.java:748)

tsegismont commented 6 years ago

Without the stacktrace and the HttpServerVerticle, it's hard to do anything but wild guessing. Can you please post update your issue? Thanks