Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2018885 | 1.2.0 | Tom Rodriguez | P2 | Closed | Fixed | 1.2beta3 |
The ThreadGCBug test crashed the Solaris VM in less 5min. But the same test
can run many days on Win32. The hardware is UltrSparc 1, os is Solaris 2.6,
using my recent JDK1.2.VM build, using green-thread(?). The test code was
developed by Sheng Liang. The source is list below, followed by screen dump
information.
/////////////////////////////////////////////////////////////////////////////
class T implements Runnable {
static int nInstance = 0;
synchronized public static int getNInstance() {return nInstance;}
synchronized public static int incNInstance() {return nInstance++;}
synchronized public static int decNInstance() {return nInstance--;}
public void run2(String a[], String a1[], int sz, String sum) {
int i;
for(i=0;i<sz;i++)
a1[i] = null;
int s = 0;
int inc;
String b;
for (i=0;i<sz;i++) {
inc = a[i].length();
if (!a[i].regionMatches(0, sum, s, inc)) {
System.out.print ("failed: i = " + i + "\n");
System.out.print (" a[i] = " + a[i] + "\n");
b = sum.substring(s, s+inc);
System.out.print (" b = " + b + "\n");
int j;
for (j=0;j<inc;j++)
System.out.print ((int)(a[i].charAt(j)) + " " + (int)(b.charAt(j)) + "\n");
break;
}
s += inc;
}
}
public void run1(int pass) {
int i;
int res;
int sz = 121;
String[] a = new String [sz];
String[] a1 = new String [sz];
String sum = "1";
a[0] = "1";
for (i=1;i<sz;i++) {
a[i] = a[i-1] + i;
a1[i] = sum;
sum = sum + a[i];
}
run2(a,a1,sz,sum);
System.out.print (Thread.currentThread() + ": pass " + pass + "\n");
}
public void run() {
try {
int i;
int n = (int)(10.0 * Math.random());
for(i=0;i<n;i++)
run1(i);
decNInstance();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
class HT implements Runnable {
public void run() {
while(true) {
try {
Thread.sleep(50);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
class ThreadGCBug {
public static void main1 (String[] args) {
Thread ht = new Thread(new HT());
ht.setPriority(7);
ht.start();
while (true) {
T.incNInstance();
Thread t = new Thread(new T());
t.start();
while (T.getNInstance() > 2) {
try {Thread.sleep(100);}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
public static void main (String[] args) {
main1(args);
int i;
for (i=0;i<10000;i++) {
int a[] = new int [100];
a [9] = i;
}
try{Thread.sleep(100000);} catch (Throwable e) {}
}
}
///////////////////////////////////////////////////////////////////////////
// Screen dump information.
> SIGSEGV 11* segmentation violation
> si_signo [11]: SIGSEGV 11* segmentation violation
> si_errno [0]: Error 0
> si_code [1]: SEGV_MAPERR [addr: 0x0]
>
> stackbase=EF1C2000, stackpointer=EF1C181C
>
> Full thread dump:
> "Thread-403" (TID:0xee3082f8, sys_thread_t:0x78340, state:R) prio=5
> "Thread-402" (TID:0xee304ec0, sys_thread_t:0x79780, state:R) prio=5
> at java.lang.String.regionMatches(String.java:698)
> at T.run2(b.java:16)
> at T.run1(b.java:44)
> at T.run(b.java:52)
> at java.lang.Thread.run(Thread.java:490)
> "Thread-401" (TID:0xee305038, sys_thread_t:0x7f070, state:R) prio=5 *current
> thread*
> at java.lang.String.<init>(String.java:157)
> at java.lang.Integer.toString(Integer.java:280)
> at java.lang.Integer.toString(Integer.java:134)
> at java.lang.String.valueOf(String.java:1469)
> at java.lang.StringBuffer.append(StringBuffer.java:454)
> at T.run1(b.java:40)
> at T.run(b.java:52)
> at java.lang.Thread.run(Thread.java:490)
> "Thread-5" (TID:0xee301100, sys_thread_t:0x6db80, state:CW) prio=7
> at java.lang.Thread.sleep(Native Method)
> at HT.run(b.java:66)
> at java.lang.Thread.run(Thread.java:490)
> "CachedReference sweeper" (TID:0xee300ec0, sys_thread_t:0x5b298, state:CW)
> prio=9
> at java.lang.Object.wait(Native Method)
> at java.lang.Object.wait(Object.java:315)
> at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
> at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:346)
> at java.lang.Thread.run(Thread.java:490)
> "Finalizer" (TID:0xee300318, sys_thread_t:0x457e8, state:CW) prio=8
> at java.lang.Object.wait(Native Method)
> at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:86)
> at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:99)
> at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
> "Reference handler" (TID:0xee3003c8, sys_thread_t:0x42138, state:CW) prio=10
> at java.lang.Object.wait(Native Method)
> at java.lang.Object.wait(Object.java:315)
> at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:198)
> "Async Garbage Collector" (TID:0xee3001b0, sys_thread_t:0x3e4f8, state:R)
> prio=1
> "Idle thread" (TID:0xee3001f8, sys_thread_t:0x3e3d8, state:R) prio=0
> "Clock" (TID:0xee3002d0, sys_thread_t:0x378d0, state:CW) prio=12
> "main" (TID:0xee300038, sys_thread_t:0x20a88, state:CW) prio=5
> at java.lang.Thread.sleep(Native Method)
> at ThreadGCBug.main1(b.java:84)
> at ThreadGCBug.main(b.java:92)
> Monitor Cache Dump:
> <unknown key> (0x3e4f8): owner "Async Garbage Collector" (0x3e4f8, 1 entry)
> Registered Monitor Dump:
> utf8 hash table: <unowned>
> JNI pinning lock: <unowned>
> JNI global reference lock: <unowned>
> BinClass lock: <unowned>
> Class linking lock: <unowned>
> System class loader lock: <unowned>
> Code rewrite lock: <unowned>
> Heap lock: <unowned>
> Monitor IO lock: <unowned>
> Child death monitor: <unowned>
> Event monitor: <unowned>
> I/O monitor: <unowned>
> Alarm monitor: <unowned>
> Waiting to be notified:
> "Clock" (0x378d0)
> Sbrk lock: <unowned>
> Thread queue lock: <unowned>
> Monitor registry: owner "Thread-401" (0x7f070, 1 entry)
> Thread Alarm Q:
> sys_thread_t 0x6db80 [Timeout in 20 ms]
> sys_thread_t 0x20a88 [Timeout in 70 ms]
> Abort
can run many days on Win32. The hardware is UltrSparc 1, os is Solaris 2.6,
using my recent JDK1.2.VM build, using green-thread(?). The test code was
developed by Sheng Liang. The source is list below, followed by screen dump
information.
/////////////////////////////////////////////////////////////////////////////
class T implements Runnable {
static int nInstance = 0;
synchronized public static int getNInstance() {return nInstance;}
synchronized public static int incNInstance() {return nInstance++;}
synchronized public static int decNInstance() {return nInstance--;}
public void run2(String a[], String a1[], int sz, String sum) {
int i;
for(i=0;i<sz;i++)
a1[i] = null;
int s = 0;
int inc;
String b;
for (i=0;i<sz;i++) {
inc = a[i].length();
if (!a[i].regionMatches(0, sum, s, inc)) {
System.out.print ("failed: i = " + i + "\n");
System.out.print (" a[i] = " + a[i] + "\n");
b = sum.substring(s, s+inc);
System.out.print (" b = " + b + "\n");
int j;
for (j=0;j<inc;j++)
System.out.print ((int)(a[i].charAt(j)) + " " + (int)(b.charAt(j)) + "\n");
break;
}
s += inc;
}
}
public void run1(int pass) {
int i;
int res;
int sz = 121;
String[] a = new String [sz];
String[] a1 = new String [sz];
String sum = "1";
a[0] = "1";
for (i=1;i<sz;i++) {
a[i] = a[i-1] + i;
a1[i] = sum;
sum = sum + a[i];
}
run2(a,a1,sz,sum);
System.out.print (Thread.currentThread() + ": pass " + pass + "\n");
}
public void run() {
try {
int i;
int n = (int)(10.0 * Math.random());
for(i=0;i<n;i++)
run1(i);
decNInstance();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
class HT implements Runnable {
public void run() {
while(true) {
try {
Thread.sleep(50);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
class ThreadGCBug {
public static void main1 (String[] args) {
Thread ht = new Thread(new HT());
ht.setPriority(7);
ht.start();
while (true) {
T.incNInstance();
Thread t = new Thread(new T());
t.start();
while (T.getNInstance() > 2) {
try {Thread.sleep(100);}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
public static void main (String[] args) {
main1(args);
int i;
for (i=0;i<10000;i++) {
int a[] = new int [100];
a [9] = i;
}
try{Thread.sleep(100000);} catch (Throwable e) {}
}
}
///////////////////////////////////////////////////////////////////////////
// Screen dump information.
> SIGSEGV 11* segmentation violation
> si_signo [11]: SIGSEGV 11* segmentation violation
> si_errno [0]: Error 0
> si_code [1]: SEGV_MAPERR [addr: 0x0]
>
> stackbase=EF1C2000, stackpointer=EF1C181C
>
> Full thread dump:
> "Thread-403" (TID:0xee3082f8, sys_thread_t:0x78340, state:R) prio=5
> "Thread-402" (TID:0xee304ec0, sys_thread_t:0x79780, state:R) prio=5
> at java.lang.String.regionMatches(String.java:698)
> at T.run2(b.java:16)
> at T.run1(b.java:44)
> at T.run(b.java:52)
> at java.lang.Thread.run(Thread.java:490)
> "Thread-401" (TID:0xee305038, sys_thread_t:0x7f070, state:R) prio=5 *current
> thread*
> at java.lang.String.<init>(String.java:157)
> at java.lang.Integer.toString(Integer.java:280)
> at java.lang.Integer.toString(Integer.java:134)
> at java.lang.String.valueOf(String.java:1469)
> at java.lang.StringBuffer.append(StringBuffer.java:454)
> at T.run1(b.java:40)
> at T.run(b.java:52)
> at java.lang.Thread.run(Thread.java:490)
> "Thread-5" (TID:0xee301100, sys_thread_t:0x6db80, state:CW) prio=7
> at java.lang.Thread.sleep(Native Method)
> at HT.run(b.java:66)
> at java.lang.Thread.run(Thread.java:490)
> "CachedReference sweeper" (TID:0xee300ec0, sys_thread_t:0x5b298, state:CW)
> prio=9
> at java.lang.Object.wait(Native Method)
> at java.lang.Object.wait(Object.java:315)
> at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
> at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:346)
> at java.lang.Thread.run(Thread.java:490)
> "Finalizer" (TID:0xee300318, sys_thread_t:0x457e8, state:CW) prio=8
> at java.lang.Object.wait(Native Method)
> at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:86)
> at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:99)
> at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
> "Reference handler" (TID:0xee3003c8, sys_thread_t:0x42138, state:CW) prio=10
> at java.lang.Object.wait(Native Method)
> at java.lang.Object.wait(Object.java:315)
> at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:198)
> "Async Garbage Collector" (TID:0xee3001b0, sys_thread_t:0x3e4f8, state:R)
> prio=1
> "Idle thread" (TID:0xee3001f8, sys_thread_t:0x3e3d8, state:R) prio=0
> "Clock" (TID:0xee3002d0, sys_thread_t:0x378d0, state:CW) prio=12
> "main" (TID:0xee300038, sys_thread_t:0x20a88, state:CW) prio=5
> at java.lang.Thread.sleep(Native Method)
> at ThreadGCBug.main1(b.java:84)
> at ThreadGCBug.main(b.java:92)
> Monitor Cache Dump:
> <unknown key> (0x3e4f8): owner "Async Garbage Collector" (0x3e4f8, 1 entry)
> Registered Monitor Dump:
> utf8 hash table: <unowned>
> JNI pinning lock: <unowned>
> JNI global reference lock: <unowned>
> BinClass lock: <unowned>
> Class linking lock: <unowned>
> System class loader lock: <unowned>
> Code rewrite lock: <unowned>
> Heap lock: <unowned>
> Monitor IO lock: <unowned>
> Child death monitor: <unowned>
> Event monitor: <unowned>
> I/O monitor: <unowned>
> Alarm monitor: <unowned>
> Waiting to be notified:
> "Clock" (0x378d0)
> Sbrk lock: <unowned>
> Thread queue lock: <unowned>
> Monitor registry: owner "Thread-401" (0x7f070, 1 entry)
> Thread Alarm Q:
> sys_thread_t 0x6db80 [Timeout in 20 ms]
> sys_thread_t 0x20a88 [Timeout in 70 ms]
> Abort
- backported by
-
JDK-2018885 ThreadGCBug test crashed Solaris VM.
-
- Closed
-