vert-x3 / vertx-zookeeper

Zookeeper based cluster manager implementation
Other
73 stars 67 forks source link

MessageConsumer completion handler called before consumer is fully registered #111

Closed vietj closed 3 years ago

vietj commented 3 years ago

Some tests relying on the clustered event bus registration propagation can fail when sending a message because the handler is not yet registered on another member of the cluster.

e.g ClusteredEventBusTest#testWriteHandler can fail after a few repeats (2 or 3) with

(NO_HANDLERS,-1) No handlers for address some-address1
    at io.vertx.core.eventbus.impl.EventBusImpl.deliverMessageLocally(EventBusImpl.java:359)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendLocally(EventBusImpl.java:319)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPub(EventBusImpl.java:307)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.sendToNode(ClusteredEventBus.java:285)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.lambda$sendOrPub$4(ClusteredEventBus.java:175)
    at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:125)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:61)
    at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:180)
    at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
    at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49)
    at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:221)
    at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:53)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
java.lang.AssertionError: No handlers for address some-address1
    at org.junit.Assert.fail(Assert.java:89)
    at io.vertx.test.core.AsyncTestBase.fail(AsyncTestBase.java:268)
    at io.vertx.test.core.AsyncTestBase.lambda$onSuccess$2(AsyncTestBase.java:650)
    at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:129)
    at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:78)
    at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:199)
    at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
    at io.vertx.core.Promise.fail(Promise.java:89)
    at io.vertx.core.eventbus.impl.OutboundDeliveryContext.written(OutboundDeliveryContext.java:92)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendLocally(EventBusImpl.java:321)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPub(EventBusImpl.java:307)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.sendToNode(ClusteredEventBus.java:285)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.lambda$sendOrPub$4(ClusteredEventBus.java:175)
    at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:125)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:61)
    at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:180)
    at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
    at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49)
    at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:221)
    at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:53)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
Unhandled exception 
java.lang.AssertionError: No handlers for address some-address1
    at org.junit.Assert.fail(Assert.java:89)
    at io.vertx.test.core.AsyncTestBase.fail(AsyncTestBase.java:268)
    at io.vertx.test.core.AsyncTestBase.lambda$onSuccess$2(AsyncTestBase.java:650)
    at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:129)
    at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:78)
    at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:199)
    at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
    at io.vertx.core.Promise.fail(Promise.java:89)
    at io.vertx.core.eventbus.impl.OutboundDeliveryContext.written(OutboundDeliveryContext.java:92)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendLocally(EventBusImpl.java:321)
    at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPub(EventBusImpl.java:307)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.sendToNode(ClusteredEventBus.java:285)
    at io.vertx.core.eventbus.impl.clustered.ClusteredEventBus.lambda$sendOrPub$4(ClusteredEventBus.java:175)
    at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:125)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:61)
    at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:180)
    at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
    at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49)
    at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:221)
    at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:53)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
  public void testSendWriteHandler() {
    startNodes(2);
    waitFor(2);
    vertices[1]
      .eventBus()
      .consumer(ADDRESS1, msg -> complete())
      .completionHandler(onSuccess(v1 -> {
        MessageProducer<String> producer = vertices[0].eventBus().sender(ADDRESS1);
        producer.write("body", onSuccess(v2 -> complete()));
      }));
    await();
  }
tsegismont commented 3 years ago

@vietj I should be able to make this test more robust for all cluster managers. But should we block the release for this? I saw you put this in the 4.0.0 milestone.

vietj commented 3 years ago

no this is not blocking, this is only annoying for testing a release

On Mon, Dec 7, 2020 at 10:02 AM Thomas Segismont notifications@github.com wrote:

@vietj https://github.com/vietj I should be able to make this test more robust for all cluster managers. But should we block the release for this? I saw you put this in the 4.0.0 milestone.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-zookeeper/issues/111#issuecomment-739778575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXDCXMLB7SCFIEHNQJJ3LSTSK2LANCNFSM4UPMSTVQ .