FULL PRODUCT VERSION :
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [versão 10.0.10240]
Linux server 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Sometimes, we have to generate thread dumps to analyze what is going on in the JVM. There are some IDEs like TDA (https://java.net/projects/tda/) and IBM Thread and Monitor Dump Analyzer for Java that parse that files to give us some insights about the scenario. However, if a thread name is greater than 1995 chars, the IDEs cannot parse that dumps because they are not properly formatted.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a thread and set its name with more than 1995 characters;
2. Run your code and create a dump with jstack -l <pid> > thread_dump.txt;
3. Open your dump in a text editor. You'll find something like this (note: should exist a quotation mark before #11):
2016-02-19 09:00:44
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.73-b02 mixed mode):
"aaaaaaaaaaaaa....aaaaaaaaa#11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
When the correct output should be:
"aaaaaaaaaaaaa....aaaaaaaaa" #11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"aaaaaaaaaaaaa....aaaaaaaaa" #11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
ACTUAL -
"aaaaaaaaaaaaa....aaaaaaaaa#11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
public class ThreadNameTest {
public static void main(String[] args) throws Exception {
Thread t = new Thread(new Runnable() {
public void run() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2000; i++) {
sb.append("a");
}
Thread.currentThread().setName(sb.toString());
try {
Thread.sleep(60000); //Now, open a new window to create a thread dump with jstack
}catch (Exception e) {
//NOOP
}
}
});
System.out.println("Starting thread...");
t.start();
System.out.println("Waiting...");
t.join();
System.out.println("Finished.");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Truncate the string before thread.setName to a value less than 1996.
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [versão 10.0.10240]
Linux server 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Sometimes, we have to generate thread dumps to analyze what is going on in the JVM. There are some IDEs like TDA (https://java.net/projects/tda/) and IBM Thread and Monitor Dump Analyzer for Java that parse that files to give us some insights about the scenario. However, if a thread name is greater than 1995 chars, the IDEs cannot parse that dumps because they are not properly formatted.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a thread and set its name with more than 1995 characters;
2. Run your code and create a dump with jstack -l <pid> > thread_dump.txt;
3. Open your dump in a text editor. You'll find something like this (note: should exist a quotation mark before #11):
2016-02-19 09:00:44
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.73-b02 mixed mode):
"aaaaaaaaaaaaa....aaaaaaaaa#11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
When the correct output should be:
"aaaaaaaaaaaaa....aaaaaaaaa" #11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"aaaaaaaaaaaaa....aaaaaaaaa" #11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
ACTUAL -
"aaaaaaaaaaaaa....aaaaaaaaa#11 daemon prio=5 os_prio=0 tid=0x0000000019e26000 nid=0x24a4 waiting on condition [0x000000001a9ee000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at test.ThreadNameTest$1.run(ThreadNameTest.java:14)
at java.lang.Thread.run(Thread.java:745)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
public class ThreadNameTest {
public static void main(String[] args) throws Exception {
Thread t = new Thread(new Runnable() {
public void run() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2000; i++) {
sb.append("a");
}
Thread.currentThread().setName(sb.toString());
try {
Thread.sleep(60000); //Now, open a new window to create a thread dump with jstack
}catch (Exception e) {
//NOOP
}
}
});
System.out.println("Starting thread...");
t.start();
System.out.println("Waiting...");
t.join();
System.out.println("Finished.");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Truncate the string before thread.setName to a value less than 1996.
- relates to
-
JDK-8153319 new test serviceability/tmtools/jstack/JstackThreadTest.java fails
-
- Closed
-