-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
ZOOKEEPER-3706: ZooKeeper.close() would leak SendThread when the netw… #1235
Conversation
zookeeper-server/src/test/java/org/apache/zookeeper/ClientCnxnSocketFragilityTest.java
Show resolved
Hide resolved
zookeeper-server/src/test/java/org/apache/zookeeper/ClientCnxnSocketFragilityTest.java
Show resolved
Hide resolved
@yfxhust |
zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
Outdated
Show resolved
Hide resolved
We observed occasional SendThread leak case in our production. But the root cause is not 100 percent sure. But from source code and some network clues, we believe that this issue is a potential cause. |
30c07d2
to
ce347e0
Compare
zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
Outdated
Show resolved
Hide resolved
zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
Outdated
Show resolved
Hide resolved
nice work - left two comments. since the request timeout is a feature disabled by default, the impact of this bug is limited to those who enabled this feature only. |
Thanks for your comments |
ce347e0
to
bf86062
Compare
left two more comments - current approach should work but I am wondering if my proposal would sound better in term of more structurally solve the race condition around the state variable; also was a little bit concerning around RuntimeException we throw and the implications it brought (w.r.t resource leaks) |
bf86062
to
74975f3
Compare
Thank you for your comments. I adapt my code with your suggestions. Please review the latest patch. |
f787f2b
to
95accad
Compare
zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
Outdated
Show resolved
Hide resolved
d1e235b
to
16500a6
Compare
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.
@hanm Do you have other concerns?
zookeeper-server/src/test/java/org/apache/zookeeper/ClientCnxnSocketFragilityTest.java
Outdated
Show resolved
Hide resolved
I just have two nits - one on the sync approach and the other on unit test. |
16500a6
to
52b2ef7
Compare
Thank you for your comments. Adapt my code with your suggestion. Please see the latest patch. |
52b2ef7
to
8938807
Compare
@hanm Any further comments ? |
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.
Any feedback from other committers? If not, I'll land this in next few days.
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.
Awesome work.
I left a few comments
zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
Outdated
Show resolved
Hide resolved
zookeeper-server/src/test/java/org/apache/zookeeper/ClientCnxnSocketFragilityTest.java
Outdated
Show resolved
Hide resolved
zookeeper-server/src/test/java/org/apache/zookeeper/ClientCnxnSocketFragilityTest.java
Outdated
Show resolved
Hide resolved
@eolivelli Thank you for your comments. I adapt the patch with your suggestions. Please review the latest patch. |
…ork is broken - add unit test to verify the bug - wrap state modification in SendThread.changeZkState() - SendThread.startConnect() could be interrupted by IOException caused by SendThread.changeZkState() Author: Fangxi Yin <[email protected]>
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
@hanm please go ahead and merge if you are okay with the latest version
merged to master - thanks for driving this @yfxhust |
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes apache#1235 from yfxhust/ZOOKEEPER-3706
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes #1235 from yfxhust/ZOOKEEPER-3706
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes apache#1235 from yfxhust/ZOOKEEPER-3706
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes apache#1235 from yfxhust/ZOOKEEPER-3706
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes apache#1235 from yfxhust/ZOOKEEPER-3706
…ork is broken - add unit test to verify the bug - bypass the SendThread.startConnect() by throw RuntimeExcepth if state.isAlive is false Author: Fangxi Yin <yinfangxikuaishou.com> Author: yinfangxi <[email protected]> Reviewers: Michael Han <[email protected]>, Enrico Olivelli <[email protected]>, maoling Closes apache#1235 from yfxhust/ZOOKEEPER-3706
…ork is broken
Author: Fangxi Yin [email protected]