-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
[ISSUE #8366] Eliminate deadlocks during the client shutdown process. #8367
Conversation
…er for a channel, no longer acquire a read lock.
rocketmq/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java Lines 479 to 484 in 32f0e84
It seems that this piece of code also may lead to deadlock. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two closeChannel method.
This piece of code also needs modification.
rocketmq/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
Lines 424 to 428 in 32f0e84
} else if (prevCW.getChannel() != channel) { | |
LOGGER.info("closeChannel: the channel[{}] has been closed before, and has been created again, nothing to do.", | |
addrRemote); | |
removeItemFromTable = false; | |
} |
Here is the same channelWrapper, and in the same thread. The lock in channelWrapper is reentrant. |
Here it needs to be changed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8367 +/- ##
=============================================
+ Coverage 43.88% 44.25% +0.37%
- Complexity 10647 10742 +95
=============================================
Files 1274 1274
Lines 88939 88941 +2
Branches 11432 11432
=============================================
+ Hits 39033 39365 +332
+ Misses 44985 44618 -367
- Partials 4921 4958 +37 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… a channel, no longer acquire a read lock.
Which Issue(s) This PR Fixes
Fixes #8366
Brief Description
ChannelWrapper.getChannel()
needs to hold the read lock. When determining ifChannelWrapper
is the wrapper for a channel, no longer acquire a read lock.