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

Add tracing to analyze child process launches

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • core-libs
    • None

      I would like to have better tracing when creating child processes. We added tracing like this to the SAP jvm back in the day and it turned out to be highly beneficial for analyzing customer issues.

      Non-exhaustive list of things to trace:
      - argument vector, environment vector
      - signal disposition just after fork and before exec
      - process signal mask
      - open files (if it can be easily obtained, eg via proc fs) after fork
      - permissions on the jspawnhelper and the target binary
      - which steps are executed when preparing the child process
      - any types of errors encountered before exec and with exec

      The tracing cannot interfere with the normal workings of spawning, so for instance it should:
      - be controlled in a way that is independent from normal JVM/program arguments. E.g., via environment variable. Alternatively, via a property; this would mirror existing mechanisms, eg. the `-Djdk.lang.Process.launchMechanism`
      - often the interesting process to trace is buried somewhere at a low level in a process tree, we should be able to trace whole trees; possibly with some sort of (primitive, not over-engineered) filtering mechanism. E.g., if I want to trace javac invocations only, possibly something like `-Djdk.lang.Process.traceChild=javac`
      - should preferably to go to a separate file since we cannot write to stdout/err since that could interfere with normal child process IO
      - since this mechanism allows to trace process trees, the file name should contain the child process pid





            stuefe Thomas Stuefe
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: