Code Monkey home page Code Monkey logo

Comments (4)

JPWatson avatar JPWatson commented on June 8, 2024

Hey @plokhotnyuk

The program is exiting the try-with-resources block immediately after the two printlns so is starting and stopping the clustered service quickly. The consensus module is waiting to receive an acknowledgement from the clustered service and gets stuck waiting and eventually interrupted. In the try-with-resources block you should wait on the shutdown signal barrier:

clusteredMediaDriver.consensusModule().context().shutdownSignalBarrier().await();

from aeron.

plokhotnyuk avatar plokhotnyuk commented on June 8, 2024

@JPWatson Please reopen the issue, because adding of clusteredMediaDriver.consensusModule().context().shutdownSignalBarrier().await(); line doesn't solve the unexpected termination error:

[0] Started Cluster Node on localhost...
[0] Exiting
Consensus Module
io.aeron.cluster.client.ClusterEvent: WARN - Aeron client in service closed unexpectedly
Consensus Module
io.aeron.cluster.client.ClusterException: WARN - failed to send service termination position: result=-1
	at io.aeron.cluster.ServiceProxy.terminationPosition(ServiceProxy.java:219)
	at io.aeron.cluster.ConsensusModuleAgent.unexpectedTermination(ConsensusModuleAgent.java:3219)
	at io.aeron.cluster.ConsensusModuleAgent.slowTickWork(ConsensusModuleAgent.java:2104)
	at io.aeron.cluster.ConsensusModuleAgent.doWork(ConsensusModuleAgent.java:338)
	at org.agrona.concurrent.AgentRunner.doWork(AgentRunner.java:304)
	at org.agrona.concurrent.AgentRunner.workLoop(AgentRunner.java:296)
	at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:162)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Consensus Module
io.aeron.cluster.service.ClusterTerminationException: unexpected termination
	at io.aeron.cluster.ConsensusModuleAgent.unexpectedTermination(ConsensusModuleAgent.java:3222)
	at io.aeron.cluster.ConsensusModuleAgent.slowTickWork(ConsensusModuleAgent.java:2104)
	at io.aeron.cluster.ConsensusModuleAgent.doWork(ConsensusModuleAgent.java:338)
	at org.agrona.concurrent.AgentRunner.doWork(AgentRunner.java:304)
	at org.agrona.concurrent.AgentRunner.workLoop(AgentRunner.java:296)
	at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:162)
	at java.base/java.lang.Thread.run(Thread.java:1583)

from aeron.

zorba128 avatar zorba128 commented on June 8, 2024

Pls just try do add Thread.sleep between releasing ClusteredServiceContainer and ClusteredMediaDriver in one of sample clusters. Either as shown (with Sleep() resource), or by nesting try-with-resources blocks and adding Thread.sleep in between.

from aeron.

JPWatson avatar JPWatson commented on June 8, 2024

The ClusteredService and ConsensusModule are monitoring each other so there will be a race between trying to shut each one down and the other being around to notice it. The graceful way to shut down a cluster is to run ClusterControl SHUTDOWN on the leader node. We have been exploring ways to more gracefully shut down a single node but there are no immediate plans to implement as it stands.

from aeron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.