Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@EranAs
Copy link

@EranAs EranAs commented Mar 12, 2025

Description of changes:

Problem description

On reconnect flow keep retrying not just for Socket exceptions but also for DNS resolution exceptions.

Detailed:

  • On a new connection establishment (createConnections) we handle DNS resolution failures and retrying by having a catch for name resolution exceptions (UnresolvedAddressException).
  • But for re-connections (attemptReconnects) we don't, and in such cases the client stop retrying and connectivity is lost for good.
  • We had a scenario where a client had network interruptions affecting both DNS and Memcached connections.
    • Memcached connections attempted retries (using FailureMode.Retry)
    • But DNS was not responsive at times, which thrown an exception which led to idleness on the client since it gave up on the connection instead of re-attempting.

Testing on a replication

The fix was verified on a replication setup to ensure it works.

  1. We opened a connection to Memcached, use a hostname endpoint to be resolved by a DNS server.
    • We use FailureMode.Retry strategy.
  2. We blocked connectivity to your DNS server
  3. We blocked memcached TCP connections until the connection is expired/closed on server side
  4. Waiting for the connection it get expired on the server, then remove the memcached block
  5. Once the DNS cache is expired, we encounter UnresolvedAddressException as the DNS block is still enabled.
  6. No retries would occur when it is in the attemptReconnects flow.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@EranAs EranAs changed the title fix: reconnects keeps retrying on DNS resolution failures fix: reconnects to keep retrying on DNS resolution failures Mar 12, 2025
@EranAs EranAs changed the title fix: reconnects to keep retrying on DNS resolution failures fix: reconnects keeps retrying on DNS resolution failures Mar 12, 2025
@QuChen88 QuChen88 merged commit ed02a25 into awslabs:master Mar 12, 2025
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

Successfully merging this pull request may close these issues.

2 participants