Hi ,
 
Please find the below fix for the issue(https://bugs.openjdk.java.net/browse/JDK-8237858). In "PlainSocketImpl_socketAccept" did not handle -1 timeout  properly.
 
In case of -1 timeout, "PlainSocketImpl_socketAccept" calls "NET_Timeout"  if it is interrupted by signal(EINTR) then in case of -1 timeout it returns immediately instead of looping again.
 
Thanks,
Vyom
 
##########################################################
diff -r d6b968af8b65 src/java.base/linux/native/libnet/linux_close.c
--- a/src/java.base/linux/native/libnet/linux_close.c    Mon Feb 24 23:44:29 2020 -0500
+++ b/src/java.base/linux/native/libnet/linux_close.c    Tue Feb 25 19:06:11 2020 +0530
@@ -437,12 +437,16 @@
          * has expired return 0 (indicating timeout expired).
          */
         if (rv < 0 && errno == EINTR) {
-            jlong newNanoTime = JVM_NanoTime(env, 0);
-            nanoTimeout -= newNanoTime - prevNanoTime;
-            if (nanoTimeout < NET_NSEC_PER_MSEC) {
-                return 0;
+            if(timeout > 0) {
+                jlong newNanoTime = JVM_NanoTime(env, 0);
+                nanoTimeout -= newNanoTime - prevNanoTime;
+                if (nanoTimeout < NET_NSEC_PER_MSEC) {
+                    return 0;
+                }
+                prevNanoTime = newNanoTime;
+            } else {
+                continue; // timeout is -1, so  loop again.
             }
-            prevNanoTime = newNanoTime;
         } else {
             return rv;
         }

############################################################

Reply via email to