Skip to content

Issue: Possible Bug in recreateConnection function #84

Open
@scarballo

Description

@scarballo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions