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

8278961: Enable debug logging in java/net/DatagramSocket/SendDatagramToBadAddress.java #6883

Closed
wants to merge 2 commits into from

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Dec 17, 2021

Can I please get a review for this test only change which proposes to enable debug logs from the test that failed intermittently? This change addresses https://bugs.openjdk.java.net/browse/JDK-8278961.

The change passes the (test specific) -d option to enable logs from that test by default. While I was at it, I even added a few more debug logs hoping it might provide some hints if/when it fails next.

For reference, a (successful) run of this test will now print something like:

----------System.out:(18/930)----------
running on OS that supports ICMP port unreachable
Testing with class java.net.DatagramSocket
tests will be run against destination address localhost/127.0.0.1 port 52682
Checking send to connected address ...
socket is locally bound to address /127.0.0.1 port 52681
received data from address /127.0.0.1 port 52681
received data from address /127.0.0.1 port 52681
received data from address /127.0.0.1 port 52681
received data from address /127.0.0.1 port 52681
received data from address /127.0.0.1 port 52681
Checking send to non-connected address ...
received data from address /127.0.0.1 port 52681
Checking send to invalid address ...
Got expected exception: java.net.PortUnreachableException
Got expected exception: java.net.PortUnreachableException
Got expected exception: java.net.PortUnreachableException
Got expected exception: java.net.PortUnreachableException
Got expected exception: java.net.PortUnreachableException

Progress

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

Issue

  • JDK-8278961: Enable debug logging in java/net/DatagramSocket/SendDatagramToBadAddress.java

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6883/head:pull/6883
$ git checkout pull/6883

Update a local copy of the PR:
$ git checkout pull/6883
$ git pull https://git.openjdk.java.net/jdk pull/6883/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6883

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6883.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 17, 2021

👋 Welcome back jpai! 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 17, 2021
@openjdk
Copy link

openjdk bot commented Dec 17, 2021

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

  • net

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 net net-dev@openjdk.org label Dec 17, 2021
@mlbridge
Copy link

mlbridge bot commented Dec 17, 2021

Webrevs

@djelinski
Copy link
Member

Does the OSsupportsFeature method still make sense? It mentions Windows 2000; I'm pretty sure every Windows version supports this today.

Also, I took a peek at JDK-8278858. The logs mention

elapsed time (seconds): 20.069

which is consistent with 5 (tries) *4seconds (timeout), which suggests that either the host firewalls ICMP "destination unreachable" packets, or our serversock.close (); call is somehow broken on that machine.

@@ -170,6 +175,8 @@ private void test(DatagramSocket sock) throws Exception {
sock.send(p);
p = new DatagramPacket(buf, buf.length, addr, port);
sock.receive (p);
print("(unexpectedly) received data from address " + p.getAddress()
+ " port " + p.getPort() + " on attempt " + i);
} catch (InterruptedIOException ex) {
print ("socket timeout");
} catch (Exception ex) {
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 catch PortUnreachableException here instead?

Copy link
Member Author

@jaikiran jaikiran Dec 18, 2021

Choose a reason for hiding this comment

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

Here too I didn't want to change the current behaviour/code of the test. It's not just this catch block but even the one a few lines above which catches InterruptedIOException. Neither the send() nor the receive() APIs of DatagramSocket specify that they throw this specific exception, but the test seems to catch it and consider it a socket timeout. So I'm guessing this test and the catch block was written with some specific context in mind and I didn't want to change that part as part of this PR which only aims to enable logging by default. Plus like Mark notes, the spec says PortUnreachableException "may" be thrown and isn't guaranteed.

Copy link
Member

Choose a reason for hiding this comment

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

Right. Looks like OSsupportsFeature was used to filter out systems that don't send "port unreachable"; we could probably use it here if the failure turns out to be OS-specific.

Additional logs look fine.

Choose a reason for hiding this comment

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

as I indicated below, we have tracked and investigated this issue and it is not purely a macosx-aarch64 issue. It may also be a test env issue. As such using the OS filtering in the test, which is designed to primarily exclued AIX, wouldn't be the appropraite approach. If we wish to exclude the test on macosx-aarch64, then use of Problemlist is more appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Mark,

I just noticed this comment. My understanding of the comment is that you don't expect any other changes to this test other than what has already been done in this PR to enable the debug logs? Is that correct?

Choose a reason for hiding this comment

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

yes, the addition of the diagnostics is useful

@@ -170,6 +175,8 @@ private void test(DatagramSocket sock) throws Exception {
sock.send(p);
p = new DatagramPacket(buf, buf.length, addr, port);
sock.receive (p);
print("(unexpectedly) received data from address " + p.getAddress()
Copy link
Member

Choose a reason for hiding this comment

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

We should immediately fail the test here

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Daniel,
I had considered that when doing this change. But this test itself appears to be very old one and I don't have any historical context of why it is doing these checks in a loop. Furthermore, even after it receives an exception (either a socket timeout one or any general exception), after setting a flag in case of a general exception, the test continues to run the next iteration of the loop. So I didn't want to change that logic, at least not this PR whose aim is to just enable debug logging.
However, if others too think we should fail here immediately, I'll go ahead do that change.

@msheppar
Copy link

it is a good idea to turn on the diagnostics -- we have used it in private test runs.

the current crop of failures are on macos-aarch64, it appears to be an OS issue, in that an ICMP destination unreachabale is not being generated for the UDP sends to an non existent socket end point. BUT, there is no obligation to do so -- it is not mandaotory in the spec, something along the lines:

"If, in the destination host, the IP module cannot deliver the datagram because the indicated protocol module or process port is not active, the destination host may send a destination unreachable message to the source host."

The question is: "is it a bug or feature in the OS?" Or it could be a host confoguration issue. There may be some configuration that has disabled ICMP, maybe a firewall policy or security setting in the kerenal, not to generate ICMP DST Unreachable responses?
We haven't found one yet.

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.

Hi Jaikiran,

What you have seems appropriate to me. Hopefully the added debug information can help us better diagnose the issue (validate/invalidate some hypothesis) next time the test fails.

@@ -24,11 +24,11 @@
/*
* @test
*
* @bug 4204320
* @bug 4204320 8278961
Copy link
Member

@dfuch dfuch Jan 12, 2022

Choose a reason for hiding this comment

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

Ah - can you remove 8278961 from the bug list before integrating?

Copy link
Member

Choose a reason for hiding this comment

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

@bug is supposed to be used to list the bugs that the test is verifying...

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Daniel,
I removed that bug id and also updated the copyright year to the new year and updated the PR. No other changes.

@openjdk
Copy link

openjdk bot commented Jan 12, 2022

@jaikiran 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:

8278961: Enable debug logging in java/net/DatagramSocket/SendDatagramToBadAddress.java

Reviewed-by: dfuchs, msheppar

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

  • b61a4af: 8259774: Deprecate -XX:FlightRecorderOptions:samplethreads
  • 6933934: 8278597: Remove outdated comments regarding RMISecurityManager in HotSpotAgent.java
  • 4851948: 8279903: Redundant modulo operation in ECDHKeyAgreement
  • 67e3d51: Merge
  • 5aecb37: 8206181: ExceptionInInitializerError: improve handling of exceptions in user-provided taglets
  • 86d0abb: 8279695: [TESTBUG] modify compiler/loopopts/TestSkeletonPredicateNegation.java to run on C1 also
  • 6d7db4b: 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!
  • 92307e5: 8278489: Preserve result in native wrapper with +UseHeavyMonitors
  • bbc1ddb: 8278267: ARM32: several vector test failures for ASHR
  • cb25029: 8279800: isAssignableFrom checks in AlgorithmParametersSpi.engineGetParameterSpec appear to be backwards
  • ... and 193 more: https://git.openjdk.java.net/jdk/compare/3607a5cdd9a3013851c8faefd346f04934f897e6...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 Jan 12, 2022
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.

LGTM. Please integrate :-)

@jaikiran
Copy link
Member Author

Thank you Daniel, Mark and @djelinski for the reviews.

@jaikiran
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 13, 2022

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

  • b61a4af: 8259774: Deprecate -XX:FlightRecorderOptions:samplethreads
  • 6933934: 8278597: Remove outdated comments regarding RMISecurityManager in HotSpotAgent.java
  • 4851948: 8279903: Redundant modulo operation in ECDHKeyAgreement
  • 67e3d51: Merge
  • 5aecb37: 8206181: ExceptionInInitializerError: improve handling of exceptions in user-provided taglets
  • 86d0abb: 8279695: [TESTBUG] modify compiler/loopopts/TestSkeletonPredicateNegation.java to run on C1 also
  • 6d7db4b: 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!
  • 92307e5: 8278489: Preserve result in native wrapper with +UseHeavyMonitors
  • bbc1ddb: 8278267: ARM32: several vector test failures for ASHR
  • cb25029: 8279800: isAssignableFrom checks in AlgorithmParametersSpi.engineGetParameterSpec appear to be backwards
  • ... and 193 more: https://git.openjdk.java.net/jdk/compare/3607a5cdd9a3013851c8faefd346f04934f897e6...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 13, 2022

@jaikiran Pushed as commit c17a012.

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

@jaikiran jaikiran deleted the 8278961 branch January 13, 2022 13:27
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 net net-dev@openjdk.org
4 participants