8133552: java/lang/ProcessHandle/InfoTest.java fails intermittently - incorrect user

8133809: Remove java/lang/ProcessHandle/InfoTest.java from the Problem List

Reviewed-by: darcy, chegar, simonis
This commit is contained in:
Roger Riggs 2015-09-11 09:25:15 -04:00
parent 4a6c0df004
commit ed3d59c71a
3 changed files with 21 additions and 12 deletions
jdk
src/java.base/linux/native/libjava
test
ProblemList.txt
java/lang/ProcessHandle

@ -141,15 +141,19 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
struct stat stat_buf;
/*
* Try to open /proc/<pid>/cmdline
* Stat /proc/<pid> to get the user id
*/
snprintf(fn, sizeof fn, "/proc/%d/cmdline", pid);
if ((fd = open(fn, O_RDONLY)) < 0) {
return;
snprintf(fn, sizeof fn, "/proc/%d", pid);
if (stat(fn, &stat_buf) == 0) {
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
}
if (fstat(fd, &stat_buf) == 0) {
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
/*
* Try to open /proc/<pid>/cmdline
*/
strncat(fn, "/cmdline", sizeof fn - strnlen(fn, sizeof fn) - 1);
if ((fd = open(fn, O_RDONLY)) < 0) {
return;
}
do { // Block to break out of on errors

@ -133,9 +133,6 @@ java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java generic-all
# 8029891
java/lang/ClassLoader/deadlock/GetResource.java generic-all
# 8133552
java/lang/ProcessHandle/InfoTest.java generic-all
############################################################################
# jdk_instrument

@ -257,10 +257,15 @@ public class InfoTest {
}
}
}
p1.waitFor(Utils.adjustTimeout(5), TimeUnit.SECONDS);
p1.sendAction("exit");
Assert.assertTrue(p1.waitFor(Utils.adjustTimeout(30L), TimeUnit.SECONDS),
"timeout waiting for process to terminate");
} catch (IOException | InterruptedException ie) {
ie.printStackTrace(System.out);
Assert.fail("unexpected exception", ie);
} finally {
// Destroy any children that still exist
ProcessUtil.destroyProcessTree(ProcessHandle.current());
}
}
@ -270,8 +275,9 @@ public class InfoTest {
@Test
public static void test3() {
try {
for (int sleepTime : Arrays.asList(1, 2)) {
for (long sleepTime : Arrays.asList(Utils.adjustTimeout(30), Utils.adjustTimeout(32))) {
Process p = spawn("sleep", String.valueOf(sleepTime));
ProcessHandle.Info info = p.info();
System.out.printf(" info: %s%n", info);
@ -297,7 +303,9 @@ public class InfoTest {
Assert.assertEquals(args[0], String.valueOf(sleepTime));
}
}
Assert.assertTrue(p.waitFor(15, TimeUnit.SECONDS));
p.destroy();
Assert.assertTrue(p.waitFor(Utils.adjustTimeout(30), TimeUnit.SECONDS),
"timeout waiting for process to terminate");
}
} catch (IOException | InterruptedException ex) {
ex.printStackTrace(System.out);