United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6225372 : Posslbe for EventQueue.invokeAndWait to never return, without deadlocking

Details
Type:
Bug
Submit Date:
2005-02-04
Status:
Resolved
Updated Date:
2011-01-31
Project Name:
JDK
Resolved Date:
2005-04-25
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2_05
Fixed Versions:
1.4.2_09 (b01)

Related Reports
Relates:

Sub Tasks

Description
Run the following program:

###-------------------------------
package mypackage;
import java.awt.EventQueue;
public class Class1 {
  public static void main(String[] args) throws Exception {
    EventQueue.invokeAndWait(new Runnable() {
      public void run() {
        throw new Error();
      }
    });
    System.out.println("hello");
  }
}
###-------------------------------

The stack trace for the Error is printed, but the invokeAndWait call never returns, normally or abruptly.  So the thread using invokeAndWait waits forever, and there is no deadlock.

In practice, we've seen this problem when using javax.swing.tree.DefaultMutableTreeNode, because some of its methods throw Error when an invariant is violated.
###@###.### 2005-2-04 00:06:37 GMT

                                    

Comments
EVALUATION

Not reproducible with tiger or mustang on any platform. It's also unable to reproduce it with 1.4.2 on Windows. It seems that it was fixed in 4403712.
###@###.### 2005-2-08 13:13:27 GMT

Retargetting to an update release manager.
###@###.### 2005-2-08 13:20:31 GMT

The bug is reproduceable on 1.4.2, 1.4.2_08 on windows and sparc. It has been fixed in tiger.

File: InvocationEvent.java, method: dispatch()
In 1.4.2
            try {
                runnable.run();
            }
            catch (Exception e) {
		exception = e;
            }

In 1.5.0
            try {
                runnable.run();
            }
            catch (Throwable t) {
		if (t instanceof Exception) {
                    exception = (Exception) t;
		}
            	throwable = t;
            }

The fix in 1.5 needs to be backported to 1.4.2

###@###.### 2005-2-10 02:44:54 GMT

The bug has been fixed by adding a new private method getThrowableObject() in java/awt/event/InvocationEvent.java and retrieving the Throwable object through reflection in invokeAndWait(...) method of EventQueue.java

###@###.### 2005-03-14 23:15:15 GMT
                                     
2005-02-08



Hardware and Software, Engineered to Work Together