RFR 8202835: jfr/event/os/TestSystemProcess.java fails on missing events
B. Blaser
bsrbnd at gmail.com
Sat May 19 16:31:40 UTC 2018
On 17 May 2018 at 22:10, B. Blaser <bsrbnd at gmail.com> wrote:
> 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.
Looking closer at 'ProcessIterator', I note that copying 'dirent' is
unnecessary. Here is the updated fix.
Any comment or review is welcome.
Thanks,
Bernard
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 Sat May 19 17:22:18 2018 +0200
@@ -903,21 +903,14 @@
}
int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() {
- struct dirent* entry;
-
if (!is_valid()) {
return OS_ERR;
}
do {
- entry = os::readdir(_dir, _entry);
- if (entry == NULL) {
- // error
- _valid = false;
- return OS_ERR;
- }
+ _entry = os::readdir(_dir, NULL);
if (_entry == NULL) {
- // reached end
+ // reached end or error
_valid = false;
return OS_ERR;
}
@@ -935,10 +928,6 @@
bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
_dir = opendir("/proc");
- _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct
dirent) + NAME_MAX + 1, mtInternal);
- if (NULL == _entry) {
- return false;
- }
_valid = true;
next_process();
@@ -946,9 +935,6 @@
}
SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() {
- if (_entry != NULL) {
- FREE_C_HEAP_ARRAY(char, _entry);
- }
if (_dir != NULL) {
closedir(_dir);
}
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 Sat May 19 17:22:18 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
diff -r 8e4fcfb4cfe4 test/jdk/TEST.groups
--- a/test/jdk/TEST.groups Thu May 17 10:32:26 2018 +0200
+++ b/test/jdk/TEST.groups Sat May 19 17:22:18 2018 +0200
@@ -465,6 +465,7 @@
jdk/jfr/api/recording/event/TestLoadEventAfterStart.java \
jdk/jfr/api/recording/state/TestState.java \
jdk/jfr/event/os/TestCPULoad.java \
+ jdk/jfr/event/os/TestSystemProcess.java \
jdk/jfr/event/compiler/TestAllocInNewTLAB.java \
jdk/jfr/jcmd/TestJcmdStartStopDefault.java \
jdk/jfr/event/io/TestFileStreamEvents.java \
More information about the hotspot-dev
mailing list