[CURATOR-338] SessionFailRetryLoop doesn't work correctly
- 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.