Skip to content

Conversation

@lvfangmin
Copy link
Contributor

No description provided.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Just for curiosity, did you test with jdk12/jdk13? Or are you using jdk8?

The behavior of SO_LINGER + socket#close changed a bit.

@lvfangmin
Copy link
Contributor Author

@eolivelli our test and prod environement are running on JDK9 and JDK10, haven't tested on JDK beyond that.

Can you point me the SO_LINGER behavior change on JDK 12/13?

@lvfangmin
Copy link
Contributor Author

retest this please

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.

Please add documentation and possibly a simple unit test.


public static void setSocketOption(Socket sock, int soTimeout) throws SocketException {
sock.setSoTimeout(soTimeout);
sock.setSoLinger(true, soLinger);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no way to turn it off. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems soLinger is always useful, and set the value to a big value is kind of turning it off, that's why we didn't add option to set it to false. Do you suggest to add it?

@lvfangmin
Copy link
Contributor Author

@anmolnar adding the test for SoLinger behavior would be tricky, and that's kind of testing the TCP socket behavior with this setting, which seems not necessary, were you suggesting if we only add a get/set test for SoLinger?

@eolivelli
Copy link
Contributor

IMHO there is no strict need of a test in this case

@lvfangmin
Copy link
Contributor Author

@anmolnar based on the comments, do you think we still need to add a test for this?

@lvfangmin
Copy link
Contributor Author

retest maven build

@anmolnar
Copy link
Contributor

anmolnar commented Oct 9, 2019

@lvfangmin Nope, I think we're good to go now, but please add short documentation to the admin docs and I'll merge.

@lvfangmin
Copy link
Contributor Author

We found the SO_LINGER option is not honored in JDK 11+, so we're changing the code to close the quorum connection in async way.

Jie is upstreaming that change in ZOOKEEPER-3574: Close quorum socket asynchronously and ZOOKEEPER-3575: Moving sending packets in Learner to a separate thread, I'll abandon this one.

@lvfangmin lvfangmin closed this Nov 14, 2019
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.

3 participants