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

8238274: (sctp) JDK-7118373 is not fixed for SctpChannel #5274

Closed
wants to merge 5 commits into from

Conversation

masyano
Copy link

@masyano masyano commented Aug 27, 2021

Please review this change to the Unix implementations of sun.nio.ch.sctp.Sctp*ChannelImpl#implCloseSelectableChannel()
to be same as SocketChannelImpl at JDK-7118373. (The preClose is missing a check for the ST_KILLED state.)


Progress

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

Issue

  • JDK-8238274: (sctp) JDK-7118373 is not fixed for SctpChannel

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5274

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Aug 27, 2021

👋 Welcome back myano! 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 label Aug 27, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 27, 2021

@masyano The following labels will be automatically applied to this pull request:

  • net
  • nio

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

@openjdk openjdk bot added nio net labels Aug 27, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Aug 27, 2021

Webrevs

@AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Aug 28, 2021

As the equivalent of JDK-7118373 in JDK 8 then the proposed change looks okay.

At some point we may have to look at aligning the SCTP channel implementations where close has been significantly re-implemented.

@dfuch
Copy link
Member

@dfuch dfuch commented Sep 2, 2021

I have run this change on one of our machines that support SCTP. I did get some intermittent failures with the other SCTP tests - they don't seem much stable - but the new proposed test was failing all the time. I suspect that using lsof to figure out whether the file descriptor was closed is not reliable/portable enough. I also tried to modify the test to use /othervm - which is probably a good idea if you don't want your results to be polluted by whatever other test might have run previously/concurrently in the agent VM - but to no avail: the test was still failing 100% of the time.
@masyano could you figure another way to detect whether the file descriptor has been released?

@AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Sep 5, 2021

/label remove nio

@openjdk openjdk bot removed the nio label Sep 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 5, 2021

@AlanBateman
The nio label was successfully removed.

@masyano
Copy link
Author

@masyano masyano commented Sep 13, 2021

@dfuch I tried to count /proc/<PID>/fd, but there are recorded all fds in the process. I don't know how to pick up only active fds in /proc/<PID>/fd. So, I will change to call lsof last one time only (like #4621), and counts all unreleased fds.

Could you try this test case?

* @bug 8238274
* @summary Potential leak file descriptor for SCTP
* @requires (os.family == "linux")
* @run main CloseDescriptors
Copy link
Member

@dfuch dfuch Sep 13, 2021

Choose a reason for hiding this comment

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

The test SctpMultiChannel/CloseDescriptors seems to work - at least it doesn't fail all the time - but it's using @run main/othervm. I believe you should make this test run in /othervm mode for more stability. I will test again with your later change and /othervm mode.

Copy link
Author

@masyano masyano Sep 14, 2021

Choose a reason for hiding this comment

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

I pushed a fix to run the test in othervm mode. Please test again.

Copy link
Member

@dfuch dfuch Sep 16, 2021

Choose a reason for hiding this comment

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

Meanwhile I did some experiment and was puzzled by the fact that the new test still failed intermittently - while the corresponding SctpMultiChannel/CloseDescriptors did not. By comparing the two I noticed that the SctpMultiChannel test is introducing some delays at key places. I did the same to the new test - and behold! It stopped failing.

Here are my changes (ignore the /othervm which you already did):

diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java
index 99f9563e016..11e2e52f577 100644
--- a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java
+++ b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java
@@ -26,7 +26,7 @@
  * @bug 8238274
  * @summary Potential leak file descriptor for SCTP
  * @requires (os.family == "linux")
- * @run main CloseDescriptors
+ * @run main/othervm CloseDescriptors
  */
 
 import java.io.BufferedReader;
@@ -79,9 +79,12 @@ public class CloseDescriptors {
             selThread = new SelectorThread();
             selThread.start();
 
+            // give time for the server and selector to start
+            Thread.sleep(100);
             for (int i = 0 ; i < 100 ; ++i) {
                 System.out.println(i);
                 doIt(port);
+                Thread.sleep(100);
             }
             System.out.println("end");
             if (!check()) {
@@ -110,6 +113,7 @@ public class CloseDescriptors {
             catch (Exception ex) {
                 ex.printStackTrace();
             }
+            Thread.sleep(200);
         }
     }
 
@@ -199,4 +203,3 @@ public class CloseDescriptors {
         }
     }
 }

Copy link
Author

@masyano masyano Sep 22, 2021

Choose a reason for hiding this comment

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

Thank you for your help. I applied your suggested fix and it works fine. But it takes about 4 minutes to be finished. So I added a timeout parameter to 250.

dfuch
dfuch approved these changes Sep 23, 2021
Copy link
Member

@dfuch dfuch left a comment

LGTM

@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

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

8238274: (sctp) JDK-7118373 is not fixed for SctpChannel

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

  • 56b8b35: 8273261: Replace 'while' cycles with iterator with enhanced-for in java.base
  • 0aa63fe: 8274216: ProblemList 2 serviceability/dcmd/gc tests with ZGC on linux-all and windows-all
  • 5ffbe75: 8274195: Doc cleanup in java.nio.file
  • 1fdc656: 8274175: (fc) java/nio/channels/FileChannel/Transfer2GPlus.java still failed in timeout
  • 3b1b8fc: 8269850: Most JDK releases report macOS version 12 as 10.16 instead of 12.0
  • 1b7f4b7: 8274169: HotSpot Style Guide has stale link to chromium style guide
  • 653a612: 8270156: Add "randomness" and "stress" keys to JTreg tests which use StressGCM, StressLCM and/or StressIGVN
  • 66ce09f: 8272703: StressSeed should be set via FLAG_SET_ERGO
  • c434528: 8273546: DecimalFormat documentation contains literal HTML character references
  • d098751: 8273916: Remove 'special' ranking
  • ... and 144 more: https://git.openjdk.java.net/jdk/compare/b0d04976bd334f840cb91e3f6dfa2ea680948a39...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 (@dfuch) 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 label Sep 23, 2021
@dfuch
Copy link
Member

@dfuch dfuch commented Sep 23, 2021

@masyano Thanks for providing this fix. If you integrate as instructed in [1] I will sponsor this change for you.
[1] #5274 (comment)

@masyano
Copy link
Author

@masyano masyano commented Sep 23, 2021

/integrate

@openjdk openjdk bot added the sponsor label Sep 23, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

@masyano
Your change (at version 5ccdaed) is now ready to be sponsored by a Committer.

@dfuch
Copy link
Member

@dfuch dfuch commented Sep 24, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Sep 24, 2021

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

  • 971aa35: 8274083: Update testing docs to mention tiered testing
  • 1d44014: 8273034: Make javadoc navigation collapsible on small displays
  • bb74ae8: 8274171: java/nio/file/Files/probeContentType/Basic.java failed on "Content type" mismatches
  • 56b8b35: 8273261: Replace 'while' cycles with iterator with enhanced-for in java.base
  • 0aa63fe: 8274216: ProblemList 2 serviceability/dcmd/gc tests with ZGC on linux-all and windows-all
  • 5ffbe75: 8274195: Doc cleanup in java.nio.file
  • 1fdc656: 8274175: (fc) java/nio/channels/FileChannel/Transfer2GPlus.java still failed in timeout
  • 3b1b8fc: 8269850: Most JDK releases report macOS version 12 as 10.16 instead of 12.0
  • 1b7f4b7: 8274169: HotSpot Style Guide has stale link to chromium style guide
  • 653a612: 8270156: Add "randomness" and "stress" keys to JTreg tests which use StressGCM, StressLCM and/or StressIGVN
  • ... and 147 more: https://git.openjdk.java.net/jdk/compare/b0d04976bd334f840cb91e3f6dfa2ea680948a39...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 24, 2021
@openjdk openjdk bot added integrated and removed ready labels Sep 24, 2021
@openjdk openjdk bot removed the rfr label Sep 24, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 24, 2021

@dfuch @masyano Pushed as commit d91e227.

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

@openjdk openjdk bot removed the sponsor label Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated net
3 participants