Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

enixon
Copy link

@enixon enixon commented Jun 21, 2019

…cket

@enixon
Copy link
Author

enixon commented Jun 21, 2019

Recreating #767 . That pull request had to be reverted because it was causing QuorumPeerMainTest::testFailedTxnAsPartOfQuorumLoss to repeatedly fail. This change does not directly effect the logic of that test but it does seem to expose a flaw in how it is staged. I believe the new change addresses that.


void closeSocket() {
try {
if (sock != null && !sock.isClosed()) {
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

@anmolnar anmolnar left a 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);
Copy link
Contributor

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?

Copy link
Author

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.

@nkalmar
Copy link
Contributor

nkalmar commented Jun 28, 2019

retest maven build

@enixon
Copy link
Author

enixon commented Jun 28, 2019

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.

Copy link
Contributor

@anmolnar anmolnar left a 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.

@asfgit asfgit closed this in 96eefaf Jul 2, 2019
@anmolnar
Copy link
Contributor

anmolnar commented Jul 2, 2019

merged to master. thanks.

@enixon enixon deleted the learner-close-socket branch July 2, 2019 17:45
stickyhipp pushed a commit to stickyhipp/zookeeper that referenced this pull request Aug 2, 2019
…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
fanyang89 pushed a commit to fanyang89/zookeeper that referenced this pull request Mar 26, 2021
…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
fanyang89 pushed a commit to fanyang89/zookeeper that referenced this pull request Mar 28, 2021
…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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
…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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
…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
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.

5 participants