Skip to content

Conversation

@acogoluegnes
Copy link
Contributor

A race condition can cause to see the channel as non-writable but end up with a new count down latch, not the one that was present when the writability flag was true. So the code waits on this new latch which will be never counted down. This can happen when the writability flips from false to true very fast.

This commit makes sure to get the latch first, then check the writability a second time. In case we get an "old" latch, it is counted down automatically, so the enqueuing code will not be blocked.

A race condition can cause to see the channel as non-writable but end up
with a new count down latch, not the one that was present when the
writability flag was true. So the code waits on this new latch which
will be never counted down. This can happen when the writability flips
from false to true very fast.

This commit makes sure to get the latch first, then check the
writability a second time. In case we get an "old" latch, it is counted
down automatically, so the enqueuing code will not be blocked.
@acogoluegnes acogoluegnes marked this pull request as ready for review August 14, 2025 09:34
@acogoluegnes acogoluegnes merged commit 90aaaa9 into main Aug 14, 2025
6 checks passed
@acogoluegnes acogoluegnes deleted the netty-fix-back-pressure branch August 14, 2025 09:34
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