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

Socket.connect does not timeout when profiling

    XMLWordPrintable

Details

    • b01
    • generic
    • linux

    Backports

      Description

        The issue was originally reported at https://github.com/async-profiler/async-profiler/issues/769

        When the wall clock profiler is enabled, `Socket.connect(address, timeout)` does not return after timeout elapses. This happens, because the poll() syscall is repeatedly restarted due to EINTR, but the timeout argument is not adjusted.

        I have reproduced the bug in pure Java without a profiler, see attached SocketTimeoutBug.java

        The issue happens on JDK 8 and JDK 11. JDK 13 switched the JDK to a new SocketImpl that doesn't have this issue. The old SocketImpl is still present in JDK 17 so it can be duplicated when running with -Djdk.net.usePlainSocketImpl.

        Attachments

          Issue Links

            Activity

              People

                yyang Yi Yang
                apangin Andrei Pangin
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: