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

Issue: Possible Bug in recreateConnection function #84

Open
scarballo opened this issue Aug 12, 2024 · 1 comment
Open

Issue: Possible Bug in recreateConnection function #84

scarballo opened this issue Aug 12, 2024 · 1 comment

Comments

@scarballo
Copy link

Description:

We have identified a potential bug in the recreateConnection function in pool.go file. When there is an issue with the connection, the function attempts to recreate it. However, if an error is thrown during this process, the function currently uses a return statement, which causes the goroutine to stop. As a result, the connection is never successfully recreated.

return

Proposed Fix:

To address this issue, the return statement should be replaced with a continue statement. This change will ensure that the goroutine continues to run and will keep attempting to re-establish the connection until it is successful.

Example to Simulate the Issue:

  1. Establish the Initial Connection:

    • Start the main service and establish a connection to a test service.
  2. Stop the Test Service:

    • Manually stop the test service to simulate a connection issue.
  3. Wait for a Duration:

    • Keep the test service stopped for a duration longer than the value configured in the PoolReconnectWait option.
  4. Observe the Error Message:

    • You should see the following line in the main service logs:
      "failed to re-create connection for...."
      
  5. Re-Start the Test Service:

    • Restart the test service. Notice that the connection is never re-established, confirming the bug.
  6. Apply the Fix:

    • Modify the recreateConnection function by replacing the return statement with a continue statement.
  7. Test the Fix:

    • Restart the main service and repeat the steps above. This time, the connection should be successfully re-established after the test service is restarted.
@alovak
Copy link
Contributor

alovak commented Oct 4, 2024

@scarballo please, take a look #91

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

No branches or pull requests

2 participants