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

Logging on stdout breaks IPC via stdout usecase

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Debian10 (running inside docker)
      openjdk version "16.0.1" 2021-04-20
      OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
      OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      We start a regular subprocess using the java binary via a script and rely on being able to consume the java processes' stdout and parse it as JSON. (in the particular case to start up a small java server that communicates its random, OS-assigned TCP-port via stdout so we can connect to it later on, fully automated).
      In our particular environment the assumption that stdout is pure JSON broke because of the following log message on stdout, which we feel belongs to stderr:

      [0.000s][warning][os,container] Duplicate cpuset controllers detected. Picking /sys/fs/cgroup/cpuset, skipping /cgroup-in/cpuset.

      We have found this while googling for solutions: https://openjdk.java.net/jeps/158 containing most importantly this statement:
      "The default configuration is that all messages using warning and error level are output to stderr." which does not seem to be true in this case.

      In our opinion it should be possible for a redistributed product (relying on a preinstalled JVM to be present) to be able to rely on the ability to use stdout for IPC
      without the host java-host-process-code mixing in non-fatal logging messages

      REGRESSION : Last worked in version 15

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create a new empty folder and cd into it
      - Download and extract jdk16 or 16.01 into it
      - Create a file called "Dockerfile" with the following contents
      FROM debian:10
      ADD jdk-16 /jdk-16
      - Build a docker container using the command
         docker build -t jdk16-logging-repro -f Dockerfile .
      - run it using the following command
        docker run -it --rm -v /sys/fs/cgroup:/cgroup-in:ro jdk16-logging-repro
      - inside the container do a "jdk16/bin/java -version 2>/dev/null"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No output or only the java version information
      ACTUAL -
      [0.000s][warning][os,container] Duplicate cpuset controllers detected. Picking /sys/fs/cgroup/cpuset, skipping /cgroup-in/cpuset.

      CUSTOMER SUBMITTED WORKAROUND :
      Can be worked around by not specifying "-v /sys/fs/cgroup:/cgroup-in:ro" on the docker invocation or by reconfiguring logging e.g. via "-Xlog:disable -Xlog:all=warning:stderr:uptime,level,tags".

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            sswsharm swati sharma
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: