-Xlog stdout default breaks generated files

XMLWordPrintable

      I have been seeing occasional errors building the JDK similar to the following:

      ```
      build/support/gensrc/java.desktop/sun/awt/AWTIcon64_security_icon_yellow24_png.java:4: error: illegal start of expression
      [0.010s][warning][perf,memops] Cannot use file /tmp/hsperfdata_... because it is locked by another process (errno = 11)
      ^
      ```

      The tool that generates e.g. AWTIcon64_security_icon_yellow24_png.java has -Xlog output to stdout enabled, and the log output ends up in the output file for the tool.

      I think the build logic for this specific is here:

      * https://github.com/openjdk/jdk/blob/0db47028913b64b84116d912876c58b136a9f70c/make/modules/java.desktop/gensrc/GensrcIcons.gmk#L73
      * https://github.com/openjdk/jdk/blob/0db47028913b64b84116d912876c58b136a9f70c/make/ToolsJdk.gmk#L104-L105

      Per https://openjdk.org/jeps/158

      > The default configuration is that all messages using warning and error level are output to stderr.

      However the actual implementation was changed to default to stdout in JDK-8153723. There's some related discussion in JDK-8272121, JDK-8357014.

      I've seen this cause a number of similar issues in other tools, which pipe stdout to a file and get broken if the JVM happens to log anything to stdout while they're running.

      One fix would be to update the -Xlog implementation to implement the stderr default described in JEP-158.

      Otherwise the OpenJDK build may want to explicitly configure logging to stderr using ` -Xlog:disable -Xlog:all=warning:stderr`, for TOOL_AWT_TOBIN and other similar tools that pipe stdout to a file.

            Assignee:
            Unassigned
            Reporter:
            Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: