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

Fix consumer might not subscribe after a reconnection #438

Merged

Conversation

BewareMyPower
Copy link
Contributor

Fixes #436

Motivation

When a consumer starts grabbing the connection, it registers a timer after the operation timeout. When that timer is expired, it will fail the connection and cancel the connection timer. However, it results a race condition that:

  1. The consumer's connection is closed (e.g. the keep alive timer failed)
  2. The connection timer is registered on the executor and will trigger the reconnection after 100ms
  3. The connection timer is cancelled, then the reconnection won't start.

Modifications

Cancel the creationTimer_ once HandlerBase#start succeeded first time. Add testReconnectWhenFirstConnectTimedOut to cover this case.

@BewareMyPower BewareMyPower added this to the 3.6.0 milestone Jul 31, 2024
@BewareMyPower BewareMyPower self-assigned this Jul 31, 2024
Fixes apache#436

### Motivation

When a consumer starts grabbing the connection, it registers a timer after the operation timeout. When that
timer is expired, it will fail the connection and cancel the connection timer. However, it results a race
condition that:
  1. The consumer's connection is closed (e.g. the keep alive timer failed)
  2. The connection timer is registered on the executor and will trigger the reconnection after 100ms
  3. The connection timer is cancelled, then the reconnection won't start.

### Modifications

Cancel the `creationTimer_` once `HandlerBase#start` succeeded first
time. Add `testReconnectWhenFirstConnectTimedOut` to cover this case.
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-consumer-retry branch from 383ac0c to 37948e5 Compare July 31, 2024 13:04
@BewareMyPower BewareMyPower added the bug Something isn't working label Jul 31, 2024
@BewareMyPower BewareMyPower merged commit 5940cb5 into apache:main Aug 13, 2024
15 checks passed
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 this pull request may close these issues.

[Bug] Consumer might not subscribe the topic after keep alive timer failed
2 participants