Vertx test on context issues deploying verticle

72 views
Skip to first unread message

Havhev Car My

unread,
Jan 9, 2017, 7:53:31 AM1/9/17
to vert.x
So this is a bit of a sneaky one, it doesn't occur 100% of the time, but this is the situation:

I created a `JUnit` integration class, declared a `Rule` to run on context, then i extract the `vertx` object from the rule. Then i deploy new verticles to the `vertx`, and if try to deploy more than ~3-4 verticles i get this for each verticle:

    Jan 09, 2017 2:43:33 PM io.vertx.core.impl.ContextImpl
    SEVERE: Unhandled exception
    java.lang.IllegalStateException: Result is already complete: succeeded
    at io.vertx.core.impl.FutureImpl.checkComplete(FutureImpl.java:164)
    at io.vertx.core.impl.FutureImpl.complete(FutureImpl.java:108)
    at io.vertx.core.impl.FutureImpl.handle(FutureImpl.java:135)
    at io.vertx.core.impl.FutureImpl.handle(FutureImpl.java:23)
    at io.vertx.core.eventbus.impl.EventBusImpl.lambda$callCompletionHandlerAsync$2(EventBusImpl.java:340)
    at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:316)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
    at java.lang.Thread.run(Thread.java:745)

The code causing this issue looks like that:

    @RunWith(VertxUnitRunner.class)
    public class VertxTest {
    
        @Rule
        public RunTestOnContext rule = new RunTestOnContext(Vertx::vertx);

        @Test
        public void testLinearExecution(TestContext context) {
            Vertx vertx = rule.vertx();
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
            vertx.deployVerticle(new AbstractVerticle() {
                @Override
                public void start() throws Exception {
                    this.vertx.eventBus().consumer("bla", event -> {});
                }
            });
        }
    
    }

It might depend on the machine running it, but my guess is that if it doesn't reproduce, add more of those guys to make it more probable:

    vertx.deployVerticle(new AbstractVerticle() {
        @Override
        public void start() throws Exception {
            this.vertx.eventBus().consumer("bla", event -> {});
        }
    });

Another thing to mention is that if i change `Vertx vertx = rule.vertx();` with `Vertx vertx = Vertx.vertx();`, i get the warning message to console, but the problem goes away.

So, am i doing something wrong? Is it an issue?

Julien Viet

unread,
Jan 9, 2017, 2:05:10 PM1/9/17
to ve...@googlegroups.com
it is only logging, nothing should affect your app or runtime

please see : https://github.com/eclipse/vert.x/issues/1658


--
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+un...@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/92f7c906-dfbe-41bf-b405-0125d76f70e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Havhev Car My

unread,
Jan 10, 2017, 3:30:23 AM1/10/17
to vert.x
Hi Julian, thanks for the reply. It actually breaks the test although not having any production-related issues.
For now I'm using Vertex.vertx() to walk around it. Just wanted to make sure I hit a known issue and not did something wrong.

Thanks.

Julien Viet

unread,
Jan 10, 2017, 5:20:09 AM1/10/17
to ve...@googlegroups.com
how does it break your test ?
> --
> 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+un...@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/71f9ccac-35ac-46ea-a977-b95bdbebcd39%40googlegroups.com.

Havhev Car My

unread,
Jan 10, 2017, 8:55:37 AM1/10/17
to vert.x
Your'e right....i'm sorry, i've was seeing too many red lines in the console so i ignore the green one mentioning the test pass.
Sorry and thanks.
Reply all
Reply to author
Forward
0 new messages