-
Bug
-
Resolution: Won't Fix
-
P4
-
7, 8
-
None
-
generic
-
generic
SYNOPSIS
--------
Code generated by IDLJ is not thread-safe
OPERATING SYSTEMS
-----------------
All Platforms, but Windows appears to deadlock the testcase more consistently.
FULL JDK VERSIONS
-----------------
All 1.4.2, 5.0, 6 and 7. Note, JDK 7 seems to deadlock much less than 6.
PROBLEM DESCRIPTION
-------------------
Java code generated by IDLJ (%JAVA_HOME%/bin/idlj) from an IDL source has been determined to cause a deadlock. The deadlock occurs when one type is embedded in another, and initialization of these types is attempted (by calling the type() method) concurrently on two or more threads.
Example output:
------------------------------------------------------------------------
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x0afba774 (object 0x070439d0, a java.lang.Class),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x0aff4e0c (object 0x07045d28, a java.lang.Class),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at StructAHelper.type(StructAHelper.java:30)
- waiting to lock <0x070439d0> (a java.lang.Class for StructAHelper)
at StructBHelper.type(StructBHelper.java:43)
- locked <0x07045d28> (a java.lang.Class for org.omg.CORBA.TypeCode)
- locked <0x07044728> (a java.lang.Class for StructBHelper)
at DeadlockTest.run(DeadlockTest.java:16)
at java.lang.Thread.run(Thread.java:619)
"Thread-0":
at StructAHelper.type(StructAHelper.java:34)
- waiting to lock <0x07045d28> (a java.lang.Class for org.omg.CORBA.TypeCode)
- locked <0x070439d0> (a java.lang.Class for StructAHelper)
at DeadlockTest.run(DeadlockTest.java:13)
at java.lang.Thread.run(Thread.java:619)
Found 1 deadlock.
------------------------------------------------------------------------
TESTCASE SOURCE
---------------
------------------------------------------------------------------------
Deadlock.idl
------------------------------------------------------------------------
struct StructA {
long a;
};
struct StructB {
StructA s;
};
------------------------------------------------------------------------
------------------------------------------------------------------------
DeadlockTest.java
------------------------------------------------------------------------
public class DeadlockTest implements Runnable {
private int selectM;
public DeadlockTest(int selectM) {
this.selectM = selectM;
}
private DeadlockTest() {};
public void run() {
switch ( selectM ) {
case 0:
StructAHelper.type();
break;
case 1:
StructBHelper.type();
break;
}
}
public static void main(String[] args) {
DeadlockTest d1 = new DeadlockTest(0);
DeadlockTest d2 = new DeadlockTest(1);
Thread t1 = new Thread(d1);
Thread t2 = new Thread(d2);
t1.start();
t2.start();
try {
System.out.print("Threads started, waiting for completion...");
t1.join();
t2.join();
System.out.println("success");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
------------------------------------------------------------------------
REPRODUCTION INSTRUCTIONS
-------------------------
1. Place both testcase files in the same directory
2. Run "idlj Deadlock.idl"
3. Run "javac *.java"
4. Run java DeadlockTest
5. Observe that it will result in deadlock for at least one/two times in
20 runs.
WORKAROUND
N/A
--------
Code generated by IDLJ is not thread-safe
OPERATING SYSTEMS
-----------------
All Platforms, but Windows appears to deadlock the testcase more consistently.
FULL JDK VERSIONS
-----------------
All 1.4.2, 5.0, 6 and 7. Note, JDK 7 seems to deadlock much less than 6.
PROBLEM DESCRIPTION
-------------------
Java code generated by IDLJ (%JAVA_HOME%/bin/idlj) from an IDL source has been determined to cause a deadlock. The deadlock occurs when one type is embedded in another, and initialization of these types is attempted (by calling the type() method) concurrently on two or more threads.
Example output:
------------------------------------------------------------------------
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x0afba774 (object 0x070439d0, a java.lang.Class),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x0aff4e0c (object 0x07045d28, a java.lang.Class),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at StructAHelper.type(StructAHelper.java:30)
- waiting to lock <0x070439d0> (a java.lang.Class for StructAHelper)
at StructBHelper.type(StructBHelper.java:43)
- locked <0x07045d28> (a java.lang.Class for org.omg.CORBA.TypeCode)
- locked <0x07044728> (a java.lang.Class for StructBHelper)
at DeadlockTest.run(DeadlockTest.java:16)
at java.lang.Thread.run(Thread.java:619)
"Thread-0":
at StructAHelper.type(StructAHelper.java:34)
- waiting to lock <0x07045d28> (a java.lang.Class for org.omg.CORBA.TypeCode)
- locked <0x070439d0> (a java.lang.Class for StructAHelper)
at DeadlockTest.run(DeadlockTest.java:13)
at java.lang.Thread.run(Thread.java:619)
Found 1 deadlock.
------------------------------------------------------------------------
TESTCASE SOURCE
---------------
------------------------------------------------------------------------
Deadlock.idl
------------------------------------------------------------------------
struct StructA {
long a;
};
struct StructB {
StructA s;
};
------------------------------------------------------------------------
------------------------------------------------------------------------
DeadlockTest.java
------------------------------------------------------------------------
public class DeadlockTest implements Runnable {
private int selectM;
public DeadlockTest(int selectM) {
this.selectM = selectM;
}
private DeadlockTest() {};
public void run() {
switch ( selectM ) {
case 0:
StructAHelper.type();
break;
case 1:
StructBHelper.type();
break;
}
}
public static void main(String[] args) {
DeadlockTest d1 = new DeadlockTest(0);
DeadlockTest d2 = new DeadlockTest(1);
Thread t1 = new Thread(d1);
Thread t2 = new Thread(d2);
t1.start();
t2.start();
try {
System.out.print("Threads started, waiting for completion...");
t1.join();
t2.join();
System.out.println("success");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
------------------------------------------------------------------------
REPRODUCTION INSTRUCTIONS
-------------------------
1. Place both testcase files in the same directory
2. Run "idlj Deadlock.idl"
3. Run "javac *.java"
4. Run java DeadlockTest
5. Observe that it will result in deadlock for at least one/two times in
20 runs.
WORKAROUND
N/A
- relates to
-
JDK-8017772 Java Library deadlock -- in the CORBA-API
- Closed
-
JDK-8049840 Corba classes deadlock
- Closed
-
JDK-8036570 Java Library deadlock -- in the CORBA-API
- Closed
-
JDK-8049838 Corba classes deadlock
- Closed