Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetryPolicy: After failing the last connection attempt, the retry time is still applied #702

Closed
jwaeab opened this issue Aug 23, 2024 · 0 comments · Fixed by #709
Closed
Assignees
Labels
bug Something isn't working

Comments

@jwaeab
Copy link
Collaborator

jwaeab commented Aug 23, 2024

When ecChronos is trying to connect through CQL and those attempts fail, ecChronos will retry a set number of times (according to retry policy settings, which is 5 by default). After each attempt it will wait a bit before the next attempt. However, after the last attempt, it still waits before moving on. This should not be the case. It should fail and move on immediately.

Log example:

07:19:59.039 [main] WARN  c.e.b.c.e.a.DefaultNativeConnectionProvider - Unable to connect through CQL using localhost:9042, retrying.
07:19:59.040 [main] WARN  c.e.b.c.e.a.DefaultNativeConnectionProvider - Connection failed in attempt 5 of 5. Retrying in 30 seconds.
07:20:29.045 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: 
...

After the "attempt", notice the delay is still in effect. It should move on to cancelling refresh attempt immediately.

The code:

        LOG.warn("Connection failed in attempt {} of {}. Retrying in {} seconds.",
        attempt, retryPolicy.getMaxAttempts(), TimeUnit.MILLISECONDS.toSeconds(delay));
        try
        {
            Thread.sleep(delay);
        }

This is recreated by just trying to start ecChronos, without any reachable Cassandra node being present.

Perhaps splitting the log output, so the failed/retrying parts are output as applicable.

@jwaeab jwaeab added the bug Something isn't working label Aug 23, 2024
@jwaeab jwaeab self-assigned this Aug 23, 2024
jwaeab added a commit to jwaeab/ecchronos that referenced this issue Sep 2, 2024
@jwaeab jwaeab closed this as completed in a760817 Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant