New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the lifecycle management of the join control thread in zen discovery. #8327
Improve the lifecycle management of the join control thread in zen discovery. #8327
Conversation
} | ||
}); | ||
} catch (Exception e) { | ||
sendPingsHandler.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to rethrow here, right?
Looking good. left two comments. |
@bleskes I updated the PR. |
/** | ||
* Wraps the specified exception in a runtime exception if required and then rethrows it. | ||
* | ||
* Usable for assertions too because of the boolean return value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's only usabe in assertions :) can you give a usage example? . Maybe call it reThrowIfNotNull and allow passing null values into it? might make it more usefull .
@bleskes I applied the feedback, also added better error handling for multicast ping. |
* | ||
* Also usable for assertions, because of the boolean return value. | ||
*/ | ||
public static boolean reThrowIfNotNull(Throwable e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is renamed we need to allow for null as a value of e?
@martijnvg looking good. left two last little comments |
@bleskes Thanks, I updated the PR to address your comments. |
@@ -1281,7 +1281,7 @@ public ClusterState stopRunningThreadAndRejoin(ClusterState clusterState, String | |||
return rejoin(clusterState, reason); | |||
} | |||
|
|||
/** starts a new joining thread if there is no currently active one */ | |||
/** starts a new joining thread if there is no currently active one and join thread controlling is started */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
join thread controlling is started
<-- love it :)
Left one minor logging comment. LGTM! |
…d in zen discovery. Also added: * Better exception handling in UnicastZenPing#ping and MulticastZenPing#ping * In the join thread that runs the innerJoinCluster loop, remember the last known exception and throw that when assertions are enabled. We loop until inner join has completed and if continues exceptions are thrown we should fail the test, because the exception shouldn't occur in production (at least not too often). Applied feedback 3 Closes elastic#8327
8a27d38
to
4ddb057
Compare
…d in zen discovery. Also added: * Better exception handling in UnicastZenPing#ping and MulticastZenPing#ping * In the join thread that runs the innerJoinCluster loop, remember the last known exception and throw that when assertions are enabled. We loop until inner join has completed and if continues exceptions are thrown we should fail the test, because the exception shouldn't occur in production (at least not too often). Applied feedback 3 Closes #8327
Pushed, thanks @bleskes! |
…d in zen discovery. Also added: * Better exception handling in UnicastZenPing#ping and MulticastZenPing#ping * In the join thread that runs the innerJoinCluster loop, remember the last known exception and throw that when assertions are enabled. We loop until inner join has completed and if continues exceptions are thrown we should fail the test, because the exception shouldn't occur in production (at least not too often). Applied feedback 3 Closes #8327
When a node stops, we cancel any ongoing join process. With elastic#8327, we improved this logic and wait for it to complete before shutting down the node. In our tests we typically shutdown an entire cluster at once, which makes it very likely for nodes to be joining while shutting down. This introduces a race condition where the joinThread.interrupt can happen before the thread starts waiting on pings which causes shutdown logic to be slow. This commits improves by repeatedly trying to stop the thread in smaller waits. Another side effect of the change is that we are now more likely to ping ourselves while shutting down, we results in an ugly warn level log. We now log all remote exception during pings at a debug level.
When a node stops, we cancel any ongoing join process. With #8327, we improved this logic and wait for it to complete before shutting down the node. In our tests we typically shutdown an entire cluster at once, which makes it very likely for nodes to be joining while shutting down. This introduces a race condition where the joinThread.interrupt can happen before the thread starts waiting on pings which causes shutdown logic to be slow. This commits improves by repeatedly trying to stop the thread in smaller waits. Another side effect of the change is that we are now more likely to ping ourselves while shutting down, we results in an ugly warn level log. We now log all remote exception during pings at a debug level. Closes #8359
When a node stops, we cancel any ongoing join process. With #8327, we improved this logic and wait for it to complete before shutting down the node. However, the joining thread is part of a thread pool and will not stop until the thread pool is shutdown. Another issue raised by the unneeded wait is that when we shutdown, we may ping ourselves - which results in an ugly warn level log. We now log all remote exception during pings at a debug level. Closes #8359
When a node stops, we cancel any ongoing join process. With #8327, we improved this logic and wait for it to complete before shutting down the node. However, the joining thread is part of a thread pool and will not stop until the thread pool is shutdown. Another issue raised by the unneeded wait is that when we shutdown, we may ping ourselves - which results in an ugly warn level log. We now log all remote exception during pings at a debug level. Closes #8359
When a node stops, we cancel any ongoing join process. With #8327, we improved this logic and wait for it to complete before shutting down the node. In our tests we typically shutdown an entire cluster at once, which makes it very likely for nodes to be joining while shutting down. This introduces a race condition where the joinThread.interrupt can happen before the thread starts waiting on pings which causes shutdown logic to be slow. This commits improves by repeatedly trying to stop the thread in smaller waits. Another side effect of the change is that we are now more likely to ping ourselves while shutting down, we results in an ugly warn level log. We now log all remote exception during pings at a debug level. Closes #8359
…d in zen discovery. Also added: * Better exception handling in UnicastZenPing#ping and MulticastZenPing#ping * In the join thread that runs the innerJoinCluster loop, remember the last known exception and throw that when assertions are enabled. We loop until inner join has completed and if continues exceptions are thrown we should fail the test, because the exception shouldn't occur in production (at least not too often). Applied feedback 3 Closes elastic#8327
When a node stops, we cancel any ongoing join process. With elastic#8327, we improved this logic and wait for it to complete before shutting down the node. In our tests we typically shutdown an entire cluster at once, which makes it very likely for nodes to be joining while shutting down. This introduces a race condition where the joinThread.interrupt can happen before the thread starts waiting on pings which causes shutdown logic to be slow. This commits improves by repeatedly trying to stop the thread in smaller waits. Another side effect of the change is that we are now more likely to ping ourselves while shutting down, we results in an ugly warn level log. We now log all remote exception during pings at a debug level. Closes elastic#8359
This PR also includes: