hseeberger / constructr

Coordinated (etcd, ...) cluster construction for dynamic (cloud, containers) environments
Apache License 2.0
212 stars 37 forks source link

Not handling MemberJoined and MemberUp cluster events #121

Closed markusjura closed 7 years ago

markusjura commented 8 years ago

It is possible that akka cluster MemberJoined and MemberUp events are send while the ConstructrMachine is in state AddingSelf. In this state the events are unhandled and therefore the following messages are written as warnings to the log:

2016-09-01T13:38:46Z MacBook-Pro-6.local WARN  ConstructrMachine [sourceThread=conductr-akka.actor.default-dispatcher-2, akkaTimestamp=13:38:46.609UTC, akkaSource=akka.tcp://conductr@127.0.0.1:9024/user/reaper/constructr/constructr-machine, sourceActorSystem=conductr] - unhandled event MemberUp(Member(address = akka.tcp://conductr@127.0.0.1:9044, status = Up)) in state AddingSelf
2016-09-01T13:38:46Z MacBook-Pro-6.local WARN  ConstructrMachine [sourceThread=conductr-akka.actor.default-dispatcher-30, akkaSource=akka.tcp://conductr@127.0.0.1:9034/user/reaper/constructr/constructr-machine, sourceActorSystem=conductr, akkaTimestamp=13:38:46.141UTC] - unhandled event MemberJoined(Member(address = akka.tcp://conductr@127.0.0.1:9054, status = Joining)) in state AddingSelf

The current code first unsubscribes to the akka cluster events before moving into AddingSelf state. However, it might be a raise condition that other MemberUp or MemberJoined events are received while Akka still hasn't processed the unsubscription.

markusjura commented 8 years ago

This issue does not compromise ConstructR's functionality, but a fix should be made to not print those warnings to the log.

hseeberger commented 8 years ago

Funny, just yesterday I noticed that some events are subscribed to, but not used. I think we can remove the respective subscriptions. PR welcome ;-)

markusjura commented 8 years ago

Here is a PR that fixes this situation: https://github.com/hseeberger/constructr/pull/122

I've realized that the MemberJoined and MemberUp events are indeed handled by ConstructR in the Joining state. Also, after leaving the Joining state, ConstructR unsubscribes to these events. However, as shown above it is possible that it still receives these events in the AddingSelf state. I guess this is due to a raise condition of Akka unsubscribe acknowledgement and already switched to the AddingSelf state.