Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249590

Timeout not correctly reported as SocketTimeoutException but as SocketException

    Details

    • Type: Bug
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u181
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2012

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows Server 2016, JDK 8u151

      A DESCRIPTION OF THE PROBLEM :
      *Please note, that this bug was observed on Windows Server 2016, not 2012 R2, but that platform is not selectable on the report sheet.*

      Under heavy load situations on Windows Server 2016 and JDK8 we are seeing socket timeout events, that are not correctly reported to the application as SocketTimeoutExceptions, but as SocketExceptions with a message of "recv failed". (Probably related: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8152654):

          java.net.SocketException: Unrecognized Windows Sockets error: 0: recv failed

      We believe, this is a race condition in fetching the WINSOCK error code in SocketInputStream.c - the error code is fetched too late and has changed/been reset in the mean time. We tried openJDK 8, which showed the same behviour. We tried to acquired the error code earlier in openJDK 8 and were successfully in preventing this error.

      Please note, that a patch to the same end has been applied to openJDK 12, see [1], third patch segment.

      [1]: https://hg.openjdk.java.net/jdk/jdk12/rev/9aa7ac61e68c

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open multiple/hundreds threads with socket read timeouts, send data to and fro. Some sockets should be used in a highly asymmetrical fashion: only data is sent, but none read, thus read timeouts are trigger.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      All read timeouts are reported as SocketTimeoutExceptions.
      ACTUAL -
      Some timeouts are reported as SocketExceptions, with message "recv failed".

      FREQUENCY : occasionally

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tongwan Andrew Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: