-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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-3240: Close socket on Learner shutdown to avoid dangling so… #996
Conversation
Recreating #767 . That pull request had to be reverted because it was causing |
|
||
void closeSocket() { | ||
try { | ||
if (sock != null && !sock.isClosed()) { |
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.
Just curious: why checking 'isClosed' ? Can't we call 'close' multiple times?
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.
You're completely right, this check doesn't actually contribute anything - I'll remove it.
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.
Question.
servers.mt[leader].main.quorumPeer.tickTime = LEADER_TIMEOUT_MS; | ||
// let the previous tick on the leader exhaust itself so the new tick time takes effect | ||
Thread.sleep(previousTick); |
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.
How is this change related to this patch?
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.
It comes down to timing. This test needs the leader to lag behind the actions taking place on the other servers and this change gives the test the full advantage of the leader's changed tick time. It seems that closing the socket alters the timing such that the stale Leader gets an earlier awareness of its stale status without the change.
retest maven build |
ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum fails on this change because it relies on the old behavior to prop a Leader up long enough for reconfig to fail. I'm trying to find a way to reconstruct that same behavior - if I can't, I'll have to delete the test. |
…relies on the fixed buggy behavior
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.
+1 lgtm
Please keep an eye on the test that you added sleep() to. I'm afraid we're facing a new flaky test.
merged to master. thanks. |
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket