apache / apache/curator

[CURATOR-338] SessionFailRetryLoop doesn't work correctly

Open
#858 0 comments 0 reactions 0 assignees View on GitHub
bug imported-jira-issue
Dominant language
Java
Stars
3.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

According to the documentation at https://curator.apache.org/apidocs/org/apache/curator/SessionFailRetryLoop.html

the canonical usage of SessionFailRetryLoop is:



 SessionFailRetryLoop    retryLoop = client.newSessionFailRetryLoop(mode);

retryLoop.start();
try
{
while ( retryLoop.shouldContinue() )
{
try
{
// do work
}
catch ( Exception e )
{
retryLoop.takeException(e);
}
}
}
finally
{
retryLoop.close();
}

Let's say there is an exception which can be retried (i.e. it's not session expiry.) If my understanding of the code is correct, it will never be retried.

This is because when you call shouldContinue() for the first time, isDone is set to true (https://github.com/apache/curator/blob/apache-curator-2.11.0/curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java#L204)

So, the next time shouldContinue() will return false, unless isDone is set to false in the interim. However, isDone is only updated when the session has expired and the mode is retry https://github.com/apache/curator/blob/apache-curator-2.11.0/curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java#L241

---
Originally reported by ragarwal, imported from: SessionFailRetryLoop doesn't work correctly


  • assignee: randgalt
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2025-01-21

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.