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

8251188: Update LDAP tests not to use wildcard addresses #252

Closed
wants to merge 2 commits into from

Conversation

AlekseiEfimov
Copy link
Member

@AlekseiEfimov AlekseiEfimov commented Sep 18, 2020

Hi,

Please help to review JDK-8251188 fix which helps to improve LDAP tests stability. The list of changes:

  1. Usages of wildcard address have been replaced with loopback address. This change includes addition of LDAPTestUtils.initEnv method that takes LDAP provider URL as a parameter.
  2. DeadServerTimeoutSSLTest.java was also updated to fix the intermittent failures reported by JDK-8152654 and JDK-8169942.
    Before the fix the failure rate was 1 out of 4 runs. After the fix it was executed 400+ times alongside to other LDAP tests, and showed no failures, and therefore removed from the problem list.

Thank you,
Aleksei


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8251188: Update LDAP tests not to use wildcard addresses

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/252/head:pull/252
$ git checkout pull/252

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2020

👋 Welcome back aefimov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 18, 2020
@openjdk
Copy link

openjdk bot commented Sep 18, 2020

@AlekseiEfimov The following label will be automatically applied to this pull request: core-libs.

When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label (add|remove) "label" command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Sep 18, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 18, 2020

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Very good and thorough fix Aleksei! This looks mostly very good to me - and I have only one doubt, which I commented on in the code.

Comment on lines 163 to 171
try (var socket = serverSock.accept()) {
System.err.println("Accepted connection:" + socket);
// Give LDAP client time to fully establish the connection.
// When client is done - close the accepted socket
testDone.await();
} catch (Exception e) {
System.err.println("Server socket. Failure to accept connection:");
e.printStackTrace();
}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if removing the while (true) loop will make the test more susceptible of failing in timeout if the server ever receives a connection request from an unexpected client (we've seen that happening in the past with networking tests). Is there anyway the server could attempt to verify that the accepted socket is from the expected client, and close it and go back to accepting if it's not? Maybe by looking at the accepted socket remote address & port?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the good suggestion Daniel. I will modify it to look at the remote socket's address.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Daniel,

Could you please take a look at the new version of DeadSSLLdapTimeoutTest.java with the following modifications:
DeadServerTimeoutSSLTest test was modified to use custom SocketFactory (DeadSSLSocketFactory) which tracks the first opened socket on LDAP client side. This socket is later used on server side to check if the connection initiated by test's LDAP client. If the connection was not established by LDAP client then new accept attempt is performed.

The test was never seen to fail during 200+ concurrent LDAP tests runs.

Comment on lines +169 to +193
int iteration = 0;
// Wait for socket to get opened by DeadSSLSocketFactory and connected to the test server
while (iteration++ < 20) {
if (DeadSSLSocketFactory.firstCreatedSocket.get() != null &&
DeadSSLSocketFactory.firstCreatedSocket.get().isConnected()) {
break;
}
try {
TimeUnit.MILLISECONDS.sleep(50);
} catch (InterruptedException ie) {
}
}
Socket clientSideSocket = DeadSSLSocketFactory.firstCreatedSocket.get();
System.err.printf("Got SSLSocketFactory connection after %d iterations: %s%n",
iteration, clientSideSocket);

if (clientSideSocket == null || !clientSideSocket.isConnected()) {
// If after 1000 ms client side connection is not opened - probably other local process
// tried to connect to the test server socket. Close current connection and retry accept.
continue;
} else {
// Check if accepted socket is connected to the LDAP client
if (acceptedSocket.getLocalPort() == clientSideSocket.getPort() &&
acceptedSocket.getPort() == clientSideSocket.getLocalPort() &&
acceptedSocket.getInetAddress().equals(clientSideSocket.getLocalAddress())) {
Copy link
Member

Choose a reason for hiding this comment

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

Oh - sorry about that - I didn't realize checking the client socket would be so complex. This is not obvious, but of course the socket on the server side could be accepted before the connect() call from the client side returns. And anyway the LDAP stack can/will create an unconnected socket and connect it later, so placing a trigger (CountDownLatch) in the custom socket factory might not work as it might trigger too early. Hence the waiting loop :-( ...

Good job here - I wish there had been a simpler way to do this!

@openjdk
Copy link

openjdk bot commented Sep 25, 2020

@AlekseiEfimov This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for more details.

After integration, the commit message for the final commit will be:

8251188: Update LDAP tests not to use wildcard addresses

Reviewed-by: dfuchs

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 90 new commits pushed to the master branch:

  • 1f5a033: 8253555: Make ByteSize and WordSize typed scoped enums
  • f62eefc: 8253469: ARM32 Zero: replace usages of __sync_synchronize() with OrderAccess::fence
  • 1b79326: 8242451: ensure semantics of non-capturing lambdas are preserved independent of execution mode
  • dc1ef58: 8253631: Remove unimplemented CompileBroker methods after JEP-165
  • 27d0a70: 8253633: Remove unimplemented TieredThresholdPolicy::set_carry_if_neccessary
  • e12d94a: 8253594: Remove CollectedHeap::supports_tlab_allocation
  • cfa3f74: 8245527: LDAP Channel Binding support for Java GSS/Kerberos
  • 37b7028: 8240556: Abort concurrent mark after effective eager reclamation of humongous objects
  • dcde95b: 8253586: C2: Clean up unused PhaseIterGVN::init_worklist()
  • 0b83fc0: 8235710: Remove the legacy elliptic curves
  • ... and 80 more: https://git.openjdk.java.net/jdk/compare/83b2411fd15d0890042ede118a08731ca162b951...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 25, 2020
@AlekseiEfimov
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Sep 25, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 25, 2020
@openjdk
Copy link

openjdk bot commented Sep 25, 2020

@AlekseiEfimov Since your change was applied there have been 90 commits pushed to the master branch:

  • 1f5a033: 8253555: Make ByteSize and WordSize typed scoped enums
  • f62eefc: 8253469: ARM32 Zero: replace usages of __sync_synchronize() with OrderAccess::fence
  • 1b79326: 8242451: ensure semantics of non-capturing lambdas are preserved independent of execution mode
  • dc1ef58: 8253631: Remove unimplemented CompileBroker methods after JEP-165
  • 27d0a70: 8253633: Remove unimplemented TieredThresholdPolicy::set_carry_if_neccessary
  • e12d94a: 8253594: Remove CollectedHeap::supports_tlab_allocation
  • cfa3f74: 8245527: LDAP Channel Binding support for Java GSS/Kerberos
  • 37b7028: 8240556: Abort concurrent mark after effective eager reclamation of humongous objects
  • dcde95b: 8253586: C2: Clean up unused PhaseIterGVN::init_worklist()
  • 0b83fc0: 8235710: Remove the legacy elliptic curves
  • ... and 80 more: https://git.openjdk.java.net/jdk/compare/83b2411fd15d0890042ede118a08731ca162b951...master

Your commit was automatically rebased without conflicts.

Pushed as commit a75edc2.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@AlekseiEfimov AlekseiEfimov deleted the JDK-8251188 branch January 12, 2021 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
2 participants