ARTEMIS-6159 Bound lock coordinator start so an unreachable ZooKeeper does not hang the broker#6586
Open
MyLuk wants to merge 1 commit into
Open
ARTEMIS-6159 Bound lock coordinator start so an unreachable ZooKeeper does not hang the broker#6586MyLuk wants to merge 1 commit into
MyLuk wants to merge 1 commit into
Conversation
… does not hang the broker LockCoordinator.run() started the lock manager with the unbounded start() overload. Against CuratorDistributedLockManager this delegates to start(-1, null), which blocks forever in CuratorFramework.blockUntilConnected while ZooKeeper is unreachable. Because run() executes on the coordinator's own ordered executor, a stuck start() permanently occupies that executor. stop() queues its cleanup on the same executor and waits on it with no timeout, so broker stop/restart hangs indefinitely. This also happens for a lock coordinator that isn't referenced by any acceptor or broker connection, since every configured coordinator is started unconditionally. Bound the start call to the coordinator's own check period instead: on timeout it is simply retried on the next scheduled run, at the same cadence it already runs at. Once run() can no longer block forever, stop()'s cleanup task gets its turn within one check period and returns on its own, so stop() itself did not need to change. Added LockCoordinatorTest (artemis-server) with a lock manager that blocks on start like an unreachable ZooKeeper would, and UnreachableLockManagerTest (integration-tests) with a real CuratorDistributedLockManager pointed at a closed port and an unassigned coordinator. Both hang and fail without the fix, pass with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/ARTEMIS-6159
LockCoordinator.run() started the lock manager with the unbounded start() overload. Against CuratorDistributedLockManager this delegates to start(-1, null), which blocks forever in CuratorFramework.blockUntilConnected while ZooKeeper is unreachable.
Because run() executes on the coordinator's own ordered executor, a stuck start() permanently occupies that executor. stop() queues its cleanup on the same executor and waits on it with no timeout, so broker stop/restart hangs indefinitely. This also happens for a lock coordinator that isn't referenced by any acceptor or broker connection, since every configured coordinator is started unconditionally.
Bound the start call to the coordinator's own check period instead: on timeout it is simply retried on the next scheduled run, at the same cadence it already runs at. Once run() can no longer block forever, stop()'s cleanup task gets its turn within one check period and returns on its own, so stop() itself did not need to change.
Added LockCoordinatorTest (artemis-server) with a lock manager that blocks on start like an unreachable ZooKeeper would, and UnreachableLockManagerTest (integration-tests) with a real CuratorDistributedLockManager pointed at a closed port and an unassigned coordinator. Both hang and fail without the fix, pass with it.