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

JDWP process management needs more efficient file descriptor handling

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 23
    • 23
    • core-svc
    • b09

    Description

      After the fix for JDK-8300088 some JDI/JDWP tests started exhibiting timeouts.

      [~jpai] reports:

      The root cause is this code in jdwp which does the work of launching a process (passed as a command to launch=cmdline option)

      https://github.com/openjdk/jdk/blob/master/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c#L103.

      it forks the child process and then goes ahead to close all possible file descriptor copies (from its parent) of this newly created child process. to do that it fetches the max number of allowed open descriptors (sysconf) and then iterates over it one by one (starting fd=3) to close them all. before the change in JDK-8300088, the max_fd value in that loop used to be relatively smaller 10240 and it appears that it was able to close them all in a reasonable amount of time. however, now the value returned there for max_fd is 2147483647 and by the time the test times out, that loop has only been able to close around 26839415 odd file descriptors and is still continuing to close the rest

      I had a quick look at how we handle forking in other APIs in the JDK and turns out there is a more optimal way we do it in the Process impl native code https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L74

      Attachments

        Issue Links

          Activity

            People

              jpai Jaikiran Pai
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: