Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8081652: [TESTBUG] java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java timed out intermittently #411

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -546,7 +546,6 @@ java/lang/instrument/BootClassPath/BootClassPathTest.sh 8072130 macosx-a
java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all

java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8081652 generic-all
java/lang/management/ThreadMXBean/AllThreadIds.java 8131745 generic-all

############################################################################
Expand Down
13 changes: 11 additions & 2 deletions test/jdk/java/lang/Thread/ThreadStateController.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -359,7 +359,16 @@ private void log(String msg, Object ... params) {
* @throws InterruptedException
*/
public String getLog() throws InterruptedException {
this.join();
return getLog(0);
}

/**
* Waits at most {@code millis} milliseconds for the controller
* to complete the test run and returns the generated log.
* A timeout of {@code 0} means to wait forever.
*/
public String getLog(long millis) throws InterruptedException {
this.join(millis);

return logger.toString();
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,6 +38,8 @@
* @run main ThreadMXBeanStateTest
*/

import jdk.test.lib.Utils;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.lang.management.ThreadInfo;
Expand Down Expand Up @@ -114,7 +116,7 @@ public static void main(String[] argv) throws Exception {
thread.checkThreadState(TERMINATED);
} finally {
try {
System.out.println(thread.getLog());
System.out.println(thread.getLog(Utils.adjustTimeout(60_000)));
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("TEST FAILED: Unexpected exception.");
Expand Down