Skip to content

ARTEMIS-6159 Bound lock coordinator start so an unreachable ZooKeeper does not hang the broker#6586

Open
MyLuk wants to merge 1 commit into
apache:mainfrom
MyLuk:ARTEMIS-6159
Open

ARTEMIS-6159 Bound lock coordinator start so an unreachable ZooKeeper does not hang the broker#6586
MyLuk wants to merge 1 commit into
apache:mainfrom
MyLuk:ARTEMIS-6159

Conversation

@MyLuk

@MyLuk MyLuk commented Jul 17, 2026

Copy link
Copy Markdown

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.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant