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

8297798: Timeout with DTLSOverDatagram test template #11558

Closed
wants to merge 5 commits into from

Conversation

mpdonova
Copy link
Contributor

@mpdonova mpdonova commented Dec 7, 2022

This fix is intended to address various time-out errors in tests that use DTLSOverDatagram as a test template. Based on test output from those bugs (JDK-8202059, JDK-8249562, JDK-8280185, JDK-8280186, JDK-8269887, JDK-8268899), this fix:

  • refactors the class to only create one additional thread
  • adds a CountdownLatch so if the server thread doesn't start for some reason, it is reported quickly
  • cleans up code to remove a loop condition that never fired: tests always time-out before too many loop iterations
  • removes CipherSuite.java from ProblemList

Ran the following tests 200 times each with no failures.

  • open/test/jdk/javax/net/ssl/DTLS/ClientAuth.java
  • open/test/jdk/javax/net/ssl/DTLS/PacketLossRetransmission.java
  • open/test/jdk/javax/net/ssl/DTLS/RespondToRetransmit.java
  • open/test/jdk/javax/net/ssl/DTLS/InvalidCookie.java
  • open/test/jdk/javax/net/ssl/DTLS/CipherSuite.java

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8297798: Timeout with DTLSOverDatagram test template

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11558/head:pull/11558
$ git checkout pull/11558

Update a local copy of the PR:
$ git checkout pull/11558
$ git pull https://git.openjdk.org/jdk pull/11558/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11558

View PR using the GUI difftool:
$ git pr show -t 11558

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11558.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 7, 2022

👋 Welcome back mpdonova! 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 Dec 7, 2022
@openjdk
Copy link

openjdk bot commented Dec 7, 2022

@mpdonova The following label will be automatically applied to this pull request:

  • security

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 pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label Dec 7, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 7, 2022

Webrevs

@rhalade
Copy link
Member

rhalade commented Dec 7, 2022

Since this fix will address intermittent failures from these 5 tests, can we close those 5 bugs as duplicate of this fix?

@mpdonova
Copy link
Contributor Author

mpdonova commented Dec 8, 2022

Since this fix will address intermittent failures from these 5 tests, can we close those 5 bugs as duplicate of this fix?

I'm not completely comfortable marking them as duplicate because there are a few different errors going on and I wasn't able to reproduce them. Can we mark mark them as "cannot reproduce" and include a link to this fix?

@@ -338,20 +328,33 @@ void receiveAppData(SSLEngine engine,
}
}

/*
Copy link
Member

Choose a reason for hiding this comment

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

minor: fix comment formatting

System.out.println("Exception on client side: ");
e.printStackTrace(System.out);
exc.printStackTrace(System.out);
Copy link
Member

Choose a reason for hiding this comment

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

can we log these stack traces to System.err?


if (testCase.isGoodJob()) {
return "Well done, server!";
throw e;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this flipped, earlier if isGoodJob() returns false then we throw exception.

} catch (Exception e) {
System.out.println("Exception in ClientCallable.call():");
e.printStackTrace(System.out);
clientException = e;

if (testCase.isGoodJob()) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here. Check if this is method is even used and what is the purpose of it. You may not need these checks and would prefer to have no try-catch in this method.

Copy link
Member

Choose a reason for hiding this comment

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

It is used by InvalidRecords.java test. It expects handshake to fail so overrides this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored the code to be a bit cleaner.

The InvalidRecords.java test explicitly threw an exception that is then treated as a successful test run. I refactored the test a little so it only throws an exception if the test fails.

@rhalade
Copy link
Member

rhalade commented Dec 8, 2022

I'm not completely comfortable marking them as duplicate because there are a few different errors going on and I wasn't able to reproduce them. Can we mark mark them as "cannot reproduce" and include a link to this fix?

Since all of those related bugs were for timeout, I am fine to close them as duplicate. But no objection to "cannot reproduce" as well.

Comment on lines 332 to 333
from the server. The server thread had exitted normally so the read _should_
succeed. So let's try to read a couple times before giving up.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from the server. The server thread had exitted normally so the read _should_
succeed. So let's try to read a couple times before giving up.
from the server. The server thread had exited normally so the read _should_
succeed. So let's try to read a couple of times before giving up.

@@ -401,7 +402,7 @@ boolean produceHandshakePackets(SSLEngine engine, SocketAddress socketAddr,
return false;
}

DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr) {
DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr){
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr){
DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr) {

}
}
try {
testCase.doClientSide(socket, serverSocketAddr);

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@rhalade
Copy link
Member

rhalade commented Dec 14, 2022

thanks for the updates! LGTM other than few minor format changes.

Copy link
Member

@jnimeh jnimeh left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me.

@@ -36,27 +36,32 @@

import java.net.DatagramPacket;
import java.net.SocketAddress;
import java.util.concurrent.atomic.AtomicBoolean;

/**
* Test that if handshake messages are crasged, the handshake would fail
Copy link
Member

Choose a reason for hiding this comment

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

crasged? Was that supposed to be "changed?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed the typo.

@Override
DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr) {
if ((ba.length >= 60) &&
if (needInvalidRecords.get() && (ba.length >= 60) &&
(ba[0x00] == (byte)0x16) && (ba[0x0D] == (byte)0x01) &&
(ba[0x3B] == (byte)0x00) && (ba[0x3C] > 0)) {
Copy link
Member

Choose a reason for hiding this comment

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

I just want to make sure - this test is only designed to be run for initial handshakes with cookies, not resumed handshakes, correct? I assume that is the intent since this test dates back to the initial DTLS release where resumptions didn't use cookies (that was a recent change to include support for resumption cookies).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct. The test driver (DTLSOverDataGram) doesn't do session resumption.

@openjdk
Copy link

openjdk bot commented Dec 15, 2022

@mpdonova 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 details.

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

8297798: Timeout with DTLSOverDatagram test template

Reviewed-by: jnimeh, rhalade

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 183 new commits pushed to the master branch:

  • 831b35f: 7093322: (fs spec) Files.newBufferedWriter should be clear when coding errors are detected
  • 0288210: 8298859: ProblemList java/awt/Mouse/EnterExitEvents/DragWindowTest.java on macosx-all
  • b17c524: 8298059: Linked stack watermarks don't support nesting
  • 98fa48c: 8298093: improve cleanup and error handling of awt_parseColorModel in awt_parseImage.c
  • 5f63f7a: 8298726: (fs) Change PollingWatchService to record last modified time as FileTime rather than milliseconds
  • 3ae7187: 8298498: sun/net/www/http/KeepAliveCache/B8291637.java fails with "Server exception terminating: java.net.SocketException: Socket closed"
  • b9074fa: 8298249: Excessive memory allocation in CipherInputStream AEAD decryption
  • 10bc86c: Merge
  • 80cadd4: 8298785: gc/TestFullGCCount.java fails with "invalid boolean value: null' for expression vm.opt.ExplicitGCInvokesConcurrent'"
  • ebc4710: 8298277: Replace "session" with "scope" for FFM access
  • ... and 173 more: https://git.openjdk.org/jdk/compare/bd381886e0f39d0e48b555b5e3167565d6a6b40d...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jnimeh, @rhalade) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 15, 2022
@mpdonova
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 15, 2022
@openjdk
Copy link

openjdk bot commented Dec 15, 2022

@mpdonova
Your change (at version 4bab7dc) is now ready to be sponsored by a Committer.

@rhalade
Copy link
Member

rhalade commented Dec 15, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Dec 15, 2022

Going to push as commit 4b313b5.
Since your change was applied there have been 185 commits pushed to the master branch:

  • ae8988e: 8297912: HotSpot Style Guide should permit alignas (Second Proposal Attempt)
  • 0ef3539: 8298416: Console should be declared sealed
  • 831b35f: 7093322: (fs spec) Files.newBufferedWriter should be clear when coding errors are detected
  • 0288210: 8298859: ProblemList java/awt/Mouse/EnterExitEvents/DragWindowTest.java on macosx-all
  • b17c524: 8298059: Linked stack watermarks don't support nesting
  • 98fa48c: 8298093: improve cleanup and error handling of awt_parseColorModel in awt_parseImage.c
  • 5f63f7a: 8298726: (fs) Change PollingWatchService to record last modified time as FileTime rather than milliseconds
  • 3ae7187: 8298498: sun/net/www/http/KeepAliveCache/B8291637.java fails with "Server exception terminating: java.net.SocketException: Socket closed"
  • b9074fa: 8298249: Excessive memory allocation in CipherInputStream AEAD decryption
  • 10bc86c: Merge
  • ... and 175 more: https://git.openjdk.org/jdk/compare/bd381886e0f39d0e48b555b5e3167565d6a6b40d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 15, 2022
@openjdk openjdk bot closed this Dec 15, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Dec 15, 2022
@openjdk
Copy link

openjdk bot commented Dec 15, 2022

@rhalade @mpdonova Pushed as commit 4b313b5.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants