RFR 8202835: jfr/event/os/TestSystemProcess.java fails on missing events

B. Blaser bsrbnd at gmail.com
Thu May 17 20:10:37 UTC 2018


Hi,

A recent change in 'os::readdir()' to use 'readdir' instead of the
deprecated 'readdir_r' implies to copy the returned 'dirent' if
necessary because 'readdir' uses its own buffer and not the one
provided by the caller as it was done before with 'readdir_r'.
The following fix is only intended to correct 'ProcessIterator',
further improvements will be addressed as part of:
https://bugs.openjdk.java.net/browse/JDK-8202353

Tier1 is OK.

Any comment is welcome.

Thanks,
Bernard

JBS: https://bugs.openjdk.java.net/browse/JDK-8202835

Suggested fix:

diff -r 8e4fcfb4cfe4 src/hotspot/os/linux/os_perf_linux.cpp
--- a/src/hotspot/os/linux/os_perf_linux.cpp    Thu May 17 10:32:26 2018 +0200
+++ b/src/hotspot/os/linux/os_perf_linux.cpp    Thu May 17 20:33:33 2018 +0200
@@ -721,6 +721,8 @@
     char           _exeName[PATH_MAX];
     char           _exePath[PATH_MAX];

+    static const size_t _entry_size = sizeof(struct dirent) + NAME_MAX + 1;
+
     ProcessIterator();
     ~ProcessIterator();
     bool initialize();
@@ -921,6 +923,7 @@
       _valid = false;
       return OS_ERR;
     }
+    memcpy(_entry, entry, _entry_size);
   } while(!is_valid_entry(_entry));

   _valid = true;
@@ -935,7 +938,7 @@

 bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
   _dir = opendir("/proc");
-  _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct
dirent) + NAME_MAX + 1, mtInternal);
+  _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, _entry_size, mtInternal);
   if (NULL == _entry) {
     return false;
   }
diff -r 8e4fcfb4cfe4 test/jdk/ProblemList.txt
--- a/test/jdk/ProblemList.txt    Thu May 17 10:32:26 2018 +0200
+++ b/test/jdk/ProblemList.txt    Thu May 17 20:33:33 2018 +0200
@@ -829,5 +829,4 @@

 jdk/jfr/event/io/TestInstrumentation.java
8202142    generic-all
 jdk/jfr/event/sampling/TestNative.java
8202142    generic-all
-jdk/jfr/event/os/TestSystemProcess.java
8202835    linux-all
-jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java
8203237    generic-all
\ No newline at end of file
+jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java
8203237    generic-all


More information about the hotspot-dev mailing list