RFR: 8368781: PerfMemory - make issues more transparent [v2]

David Holmes dholmes at openjdk.org
Tue Oct 14 03:44:02 UTC 2025


On Wed, 8 Oct 2025 07:27:50 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Currently issues with perfMemory like problems with the secure tmp subdirectory creation are not very transparent in release JVMs.
>> 
>> There exists some warnings traces but they are behind develop flags like Verbose so only available in debug JVMs.
>> We could (in case of issues) store some information and write it later into hsinfo/hserr files ; or make the existing warnings available too in release JVMs.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make EnhanceErrorWarningLogging DIAGNOSTIC

We already have some UL in PerfMemory:
> 8168122: Update logging in perfMemory to Unified Logging
Summary: -XX:+PerfTraceMemOps replaced with -Xlog:perf+memops=debug, -XX:+PerfTraceDataCreation replaced with -Xlog:perf+datacreation=debug

but for some reason that effort completely ignored the PrintMiscellaneous/Verbose "warnings". To keep things simple I suggest the following pattern:

diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp
index ed83487265c..968f3cea249 100644
--- a/src/hotspot/os/posix/perfMemory_posix.cpp
+++ b/src/hotspot/os/posix/perfMemory_posix.cpp
@@ -447,10 +447,11 @@ static char* get_user_name(uid_t uid) {
   int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p);
 
   if (result != 0 || p == nullptr || p->pw_name == nullptr || *(p->pw_name) == '\0') {
-    if (PrintMiscellaneous && Verbose) {
+    if (log_is_enabled(Debug, perf)) {
+      LogStreamHandle(Debug, perf) log;
       if (result != 0) {
-        warning("Could not retrieve passwd entry: %s\n",
-                os::strerror(result));
+        log->print_cr("Could not retrieve passwd entry: %s",
+                      os::strerror(result));
       }
       else if (p == nullptr) {
         // this check is added to protect against an observed problem
@@ -463,13 +464,13 @@ static char* get_user_name(uid_t uid) {
         // message may result in an erroneous message.
         // Bug Id 89052 was opened with RedHat.
         //
-        warning("Could not retrieve passwd entry: %s\n",
-                os::strerror(errno));
+        log->print_cr("Could not retrieve passwd entry: %s",
+                      os::strerror(errno));
       }
       else {
-        warning("Could not determine user name: %s\n",
-                p->pw_name == nullptr ? "pw_name = null" :
-                                     "pw_name zero length");
+        log->print_cr("Could not determine user name: %s",
+                      p->pw_name == nullptr ? "pw_name = null" :
+                                              "pw_name zero length");
       }
     }
     FREE_C_HEAP_ARRAY(char, pwbuf);

Of course you proposed changes as a potential consumer of this information, so how would you like to procure it?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27602#issuecomment-3399992595


More information about the hotspot-runtime-dev mailing list