JDK-8215699 : -Xlog::file cannot be used with named pipe
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11.0.1,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-12-19
  • Updated: 2019-10-15
  • Resolved: 2019-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13
11.0.6-oracleFixed 13 b05Fixed
Description
A DESCRIPTION OF THE PROBLEM :
Even if log rotation is not enabled, -Xlog:gc: fails to start the jvm if provided a path to a fifo (with active consumer)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
mkfifo testpipe
<in another shell> less -f testpipe
java  -Xlog:gc:file=testpipe -jar yourjar

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
output of gc logs should be written to pipe
ACTUAL -
[0.002s][error  ][logging] Unable to log to file /tmp/gclogpipe with log file rotation: /tmp/gclogpipe is not a regular file
[0.002s][error  ][logging] Initialization of output 'file=/tmp/gclogpipe' using options '(null)' failed.


FREQUENCY : always



Comments
Fix Request This is a regression and so is a prime candidate for a backport. The patch doesn't apply cleanly, but the only changes are contextual (i.e. to make the patch chunks import); logically it should be identical. webrev: http://cr.openjdk.java.net/~stooke/webrevs/jdk-8215699-jdk11u/00/ discussion: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-August/001784.html
30-08-2019

The user can work around the problem by explicitly setting the filecount to 0, like this: java -Xlog:gc:file=testpipe::filecount=0 ...
21-12-2018

Pipes are not regular files, logging framewrok throw error as "testfile is not a regular file" In JDK8 and earlier it works with -Xloggc option, So this is an issue in new framework. Current implementation check for regular file and rejects if it is not a regular file. /jdk-jdk/open/src/hotspot/share/logging/logFileOutput.cpp#229 if (!is_regular_file(_file_name)) { 230 errstream->print_cr("Unable to log to file %s with log file rotation: " 231 "%s is not a regular file", 232 _file_name, _file_name);
20-12-2018

There is another problem in this code. In case of filecount is not specified, error message should not contain "log file rotation" details Here is the problematic code /jdk-jdk/open/src/hotspot/share/logging/logFileOutput.cpp#228 228 if (_file_count > 0 && file_exists(_file_name)) { 229 if (!is_regular_file(_file_name)) { 230 errstream->print_cr("Unable to log to file %s with log file rotation: " 231 "%s is not a regular file", 232 _file_name, _file_name); 233 return false; 234 } Due to this condition "_file_count > 0" even for single file error will be printed as "Unable to log to file %s with log file rotation: ", this need to be corrected
20-12-2018