Hello all,
we have stumbled upon a problem during the shutdown of one node of
our cluster:
We want to use the eventbus during stop() to send some data (e.g.
running timers) over the net to another cluster member and that
simply does not work.
Locally the bus is usable but the clustered communication is no
longer possible in stop(), because of the following:
(VertxImpl.java, line 559ff, vertx 4.2.4):
@Override
public synchronized void
close(Handler<AsyncResult<Void>> completionHandler)
{
if (closed || eventBus == null) {
// Just call the handler directly since pools shutdown
if (completionHandler != null) {
completionHandler.handle(Future.succeededFuture());
}
return;
}
closed = true;
closeFuture.close().onComplete(ar -> {
deploymentManager.undeployAll().onComplete(ar1 -> {
HAManager haManager = haManager();
Promise<Void> haPromise = Promise.promise();
if (haManager != null) {
this.executeBlocking(fut -> {
haManager.stop();
fut.complete();
}, false, haPromise);
} else {
haPromise.complete();
}
haPromise.future().onComplete(ar2 -> {
addressResolver.close(ar3 -> {
Promise<Void> ebClose =
getOrCreateContext().promise();
eventBus.close(ebClose);
ebClose.future().onComplete(ar4 -> {
closeClusterManager(ar5 -> {
// Copy set to prevent
ConcurrentModificationException
deleteCacheDirAndShutdown(completionHandler);
});
});
});
});
});
});
}
during closeFuture.close() the NetClient of the Eventbus is closed and therefore during undeployAll() the cluster communication is no longer usable.
The ClusteredEventBus creates the NetClient as follows
(ClusteredEventBus.java, line 67ff):
public ClusteredEventBus(VertxInternal
vertx, VertxOptions options, ClusterManager clusterManager,
NodeSelector nodeSelector) {
super(vertx);
this.options = options.getEventBusOptions();
this.clusterManager = clusterManager;
this.nodeSelector = nodeSelector;
this.client = vertx.createNetClient(new
NetClientOptions(this.options.toJson()));
}
And that creates it (in VertxImpl.java) this way:
public NetClient
createNetClient(NetClientOptions options) {
CloseFuture closeFuture = new CloseFuture(log);
NetClient client = createNetClient(options, closeFuture);
CloseFuture fut = resolveCloseFuture();
fut.add(closeFuture);
return client;
}
Is it intentionally impossible to send something over a
ClusteredEventbus during stop(), is this an error that will be
fixed or is there another way/hook that can use the eventbus
during and before shutdown? What did we miss?
Thx
Jan Fengler
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/DB6PR0802MB238942BD895BB44F473356918BF49%40DB6PR0802MB2389.eurprd08.prod.outlook.com.
--
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.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/8d611231-3cab-47f0-b73a-29eee82185a0n%40googlegroups.com.