Fix: release semaphore on channel close - #135
Open
678098 wants to merge 2 commits into
Open
Conversation
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
678098
commented
Sep 4, 2026
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } | ||
| assertFalse(waiter.isAlive()); |
Contributor
Author
There was a problem hiding this comment.
Fails in main:
[ERROR] com.bloomberg.bmq.it.NettyTcpConnectionImplIT.testWaitUntilWritableReturnsWhenChannelGoesDown -- Time elapsed: 31.59 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <false> but was: <true>
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:257)
at com.bloomberg.bmq.it.NettyTcpConnectionImplIT.testWaitUntilWritableReturnsWhenChannelGoesDown(NettyTcpConnectionImplIT.java:1060)
678098
force-pushed
the
260904_connection_lock
branch
from
September 4, 2026 16:56
e529193 to
6ecb6f2
Compare
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
678098
force-pushed
the
260904_connection_lock
branch
from
September 4, 2026 17:08
6ecb6f2 to
01c4686
Compare
678098
commented
Sep 4, 2026
| // The channel is gone, so it can never become writable again. | ||
| // Release the threads waiting for that to happen; their writes | ||
| // complete with a not-connected result. | ||
| lock.notifyAll(); |
Contributor
Author
There was a problem hiding this comment.
The original code hasn't got any semaphore notification during channel close.
This meant that a thread that is blocked in waitUntilWritable will never be unblocked if a channel was closed.
We don't even need a separate semaphore to send this notification: existing lock is enough.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.