On Thu, 16 Sep 2021 10:33:09 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> I pushed a fix to run the test in othervm mode. Please test again. > > 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 { > } > } > } 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. ------------- PR: https://git.openjdk.java.net/jdk/pull/5274