Skip to content

Catch exception from ServiceLock.deleteLocks when no servers#6192

Merged
dlmarion merged 2 commits intoapache:2.1from
dlmarion:delete-lock-no-servers
Mar 10, 2026
Merged

Catch exception from ServiceLock.deleteLocks when no servers#6192
dlmarion merged 2 commits intoapache:2.1from
dlmarion:delete-lock-no-servers

Conversation

@dlmarion
Copy link
Contributor

@dlmarion dlmarion commented Mar 6, 2026

The methods in ServiceLock that delete locks throw an IllegalStateException when there are no servers in ZooKeeper at the specified path. This change catches those exceptions when it's not an error condition.

@dlmarion dlmarion added this to the 2.1.5 milestone Mar 6, 2026
@dlmarion dlmarion requested a review from ddanielr March 6, 2026 14:32
@dlmarion dlmarion self-assigned this Mar 6, 2026
@dlmarion
Copy link
Contributor Author

dlmarion commented Mar 6, 2026

Part of me wonders if the method that delete the locks should not throw an IlegalStateException when there are no servers and just return instead.

@keith-turner
Copy link
Contributor

Not sure why its throwing an exception for zero servers. If the dirs created by init are not there then may that could throw an exception.

@ddanielr ddanielr self-assigned this Mar 9, 2026
Copy link
Contributor

@ddanielr ddanielr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why its throwing an exception for zero servers. If the dirs created by init are not there then may that could throw an exception.

I'll look at the code I refactored. I agree that missing locks shouldn't resulting in a IllegalStateException.
I'm betting that's supposed to be a top level check for the dir path.

I could understand an illegal state exception when trying to delete locks for a group path that doesn't exist.

@dlmarion dlmarion merged commit c192a8b into apache:2.1 Mar 10, 2026
9 checks passed
@dlmarion dlmarion deleted the delete-lock-no-servers branch March 10, 2026 16:53
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.

3 participants