JDK-8327054 : DiagnosticCommand Compiler.perfmap does not log on output()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-02-29
  • Updated: 2024-07-29
  • Resolved: 2024-07-23
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 24
24 b08Fixed
Related Reports
Relates :  
Relates :  
Description
The dcmd "Compiler.perfmap" does not properly log information or errors in the dcmd output stream. They instead appear in stdout or stderr of the process the dcmd is running on. For example, if the file is not writable you will see the following:

j$ cmd 24089 Compiler.perfmap /x
24089:
Command executed successfully

Yet, it could not write to /x so the file is empty. If you look at the console for 24089 you see:

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /x due to Permission denied
[1129077.636s][warning][codecache] Failed to create /x for perf map

This comes from the following code:

  fileStream fs(filename, "w");
  if (!fs.is_open()) {
    log_warning(codecache)("Failed to create %s for perf map", filename);
    return;
  }

fileStream() produced the first warning to stderr, and the log_warning() output is going to stdout. Meanwhile the jcmd output shows no indication of the failure. One or both of these messages should have gone to the output stream of the dcmd. 

PerfMapDCmd::execute calls CodeCache::write_perf_map(const char* filename), so write_perf_map is unaware of the outputStream* being used for the DiagnosticCommand, which is collecting output for the client. It might be necessary to make write_perf_map aware of which output stream errors and warning message should be going to.
Comments
Changeset: 8e1f17e3 Branch: master Author: Sonia Zaldana Calles <szaldana@openjdk.org> Date: 2024-07-23 15:49:34 +0000 URL: https://git.openjdk.org/jdk/commit/8e1f17e351bc7949b318a0542a4a4cb30ead5a97
23-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20257 Date: 2024-07-19 15:07:39 +0000
19-07-2024

ILW = Information and errors not logged to dcmd output stream, only with dcmd, no workaround = LLH = P5
05-03-2024