JDK-4527596 : drag-n-drop operation hangs a java application
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.1
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2001-11-15
  • Updated: 2006-08-31
Related Reports
Relates :  
Description
The bug is reported by EDS PLM Solutions in its development of new J2EE application. They notice drag-n-drop operations cause their java application to hang. 

A small test is attached to illustrate the problem. To reproduce the problem, simply do drag-n-drop operations between two list windows.

The Java 1.3.1 is used:
SUN112.SDRC.COM:/scratch/nsjxu/java/dnd3:202$ java -version
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

The systems used here are
	Ultra10/Elite3D/Solaris 8
	SunBlade 100/Expert3D Lite/Solaris 8 10/00

Here is the patch information on one of systems:

SUN112.SDRC.COM:/scratch/nsjxu/java/dnd3:206$ showrev -p
Patch: 109896-03 Obsoletes: 109314-05 Requires: 108528-03, 108979-08,
109883-01 Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWcsxu, SUNWusb,
SUNWusbx
Patch: 109279-18 Obsoletes: 109048-06, 110180-01, 110552-01, 111541-02
Requires:  Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWcarx,
SUNWcsxu, SUNWhea, SUNWmdb, SUNWmdbx
Patch: 109740-04 Obsoletes: 109056-01, 110196-01, 110554-01 Requires:
109279-09 Incompatibles:  Packages: SUNWcsr, SUNWcarx
Patch: 109742-04 Obsoletes: 109052-01, 110556-01 Requires: 109279-09
Incompatibles:  Packages: SUNWcsr, SUNWcarx
Patch: 108652-31 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWxwfnt, SUNWxwfnt, SUNWxwice, SUNWxwice, SUNWxwplt, SUNWxwplt,
SUNWxwicx, SUNWxwicx, SUNWxwplx, SUNWxwplx, SUNWxwdxm, SUNWxwdxm,
SUNWxwslb, SUNWxwslb, SUNWxwinc, SUNWxwinc
Patch: 108940-33 Obsoletes:  Requires: 108652-25 Incompatibles:
Packages: SUNWmfrun, SUNWdtbax
Patch: 108604-16 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWafb, SUNWafb, SUNWafb, SUNWafbcf, SUNWafbcf, SUNWafbcf, SUNWafbw,
SUNWafbw, SUNWafbw, SUNWafbx, SUNWafbx, SUNWafbx
Patch: 108434-01 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWlibC
Patch: 108921-13 Obsoletes:  Requires: 108652-19 Incompatibles:
Packages: SUNWdtwm
Patch: 108605-15 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWffb, SUNWffb, SUNWffbw, SUNWffbw, SUNWffbx, SUNWffbx
Patch: 108756-01 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWifb, SUNWifbcf, SUNWifbw, SUNWifbx
Patch: 108576-14 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWifb, SUNWifbcf, SUNWifbr, SUNWifbw, SUNWifbx
Patch: 108435-01 Obsoletes:  Requires: 108434-01 Incompatibles:
Packages: SUNWlibCx
Patch: 108773-12 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWxi18n, SUNWxim, SUNWxi18x, SUNWximx
Patch: 109543-11 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWglsr
Patch: 109543-12 Obsoletes:  Requires:  Incompatibles:  Packages:
SUNWglsr, SUNWglsr


The program works OK on Windows systems.

The test program appears to work fine using the Java 1.4 Beta:
SUN112.SDRC.COM:/scratch/nsjxu/java/dnd3:201$ java -version
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)





Comments
EVALUATION Name: dsR10078 Date: 11/16/2001 The bug is reproducible on Solaris 8 with JDK 1.3.1-b24. The full thread dump at the point of hang is as follows: "AWT-Selection" prio=6 tid=0x141790 nid=0x14 waiting on monitor [0xf4301000..0xf43019e0] at java.lang.Object.wait(Native Method) - waiting on <f8d1f898> (a java.lang.Class) at sun.awt.motif.X11Selection.pGetTransferTargets(Native Method) at sun.awt.motif.SelectionThread.run(X11Selection.java:307) - locked <f4d27940> (a sun.awt.motif.SelectionThread) - locked <f4d13088> (a java.lang.Object) "TimerQueue" daemon prio=5 tid=0x1138d0 nid=0x13 waiting on monitor [0xf4501000..0xf45019e0] at java.lang.Object.wait(Native Method) - waiting on <f4d139d8> (a javax.swing.TimerQueue) at javax.swing.TimerQueue.run(TimerQueue.java:233) - locked <f4d139d8> (a javax.swing.TimerQueue) at java.lang.Thread.run(Thread.java:484) "Screen Updater" prio=5 tid=0x10d488 nid=0x10 waiting on monitor [0xf4401000..0xf44019e0] at java.lang.Object.wait(Native Method) - waiting on <f4c542c0> (a sun.awt.ScreenUpdater) at java.lang.Object.wait(Object.java:420) at sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:76) - locked <f4c542c0> (a sun.awt.ScreenUpdater) at sun.awt.ScreenUpdater.run(ScreenUpdater.java:95) "Thread-0" prio=5 tid=0x27fb0 nid=0x1 waiting on monitor [0..0xffbee810] "AWT-Motif" prio=6 tid=0x34fe58 nid=0xe runnable [0xf4600000..0xf46019e0] at java.lang.Object.notifyAll(Native Method) at sun.awt.motif.AWTLockAccess.awtUnlock(Native Method) at sun.awt.motif.MDragSourceContextPeer.startSecondaryDispatch(MDragSourceContextPeer.java:182) at sun.awt.dnd.SunDragSourceContextPeer.dodragDropFinished(SunDragSourceContextPeer.java:355) at sun.awt.motif.MDragSourceContextPeer.dragDropFinished(MDragSourceContextPeer.java:160) at sun.awt.motif.MToolkit.run(Native Method) at java.lang.Thread.run(Thread.java:484) "SunToolkit.PostEventQueue-0" prio=6 tid=0x341350 nid=0xd waiting on monitor [0xf4701000..0xf47019e0] at java.lang.Object.wait(Native Method) - waiting on <f4e100f8> (a sun.awt.PostEventQueue) at java.lang.Object.wait(Object.java:420) at sun.awt.PostEventQueue.run(SunToolkit.java:491) - locked <f4e100f8> (a sun.awt.Full thread dump: "AWT-EventQueue-0" prio=6 tid=0x340948 nid=0xc waiting on monitor [0xf4800000..0xf48019e0] at java.lang.Object.wait(Native Method) - waiting on <f4d27940> (a sun.awt.motif.SelectionThread) at java.lang.Object.wait(Object.java:420) at sun.awt.motif.X11Selection.getSelectionTargets(X11Selection.java:216) - locked <f4d27940> (a sun.awt.motif.SelectionThread) at sun.awt.motif.FullyRenderedTransferable.<init>(X11Clipboard.java:210) at sun.awt.motif.X11Clipboard.getContents(X11Clipboard.java:77) - locked <f4c20ff0> (a sun.awt.motif.X11Clipboard) at DNDList.focusGained(DNDList.java:245) at java.awt.AWTEventMulticaster.focusGained(AWTEventMulticaster.java:161) at java.awt.Component.processFocusEvent(Component.java:3639) at javax.swing.JComponent.processFocusEvent(JComponent.java:1980) at java.awt.Component.processEvent(Component.java:3535) at java.awt.Container.processEvent(Container.java:1164) at java.awt.Component.dispatchEventImpl(Component.java:2593) at java.awt.Container.dispatchEventImpl(Container.java:1213) at java.awt.Component.dispatchEvent(Component.java:2497) at java.awt.LightweightDispatcher.processFocusEvent(Container.java:2167) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2130) at java.awt.Container.dispatchEventImpl(Container.java:1200) at java.awt.Window.dispatchEventImpl(Window.java:914) at java.awt.Component.dispatchEvent(Component.java:2497) at java.awt.EventQueue.dispatchEvent(EventQueue.java:339) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:85) "Signal Dispatcher" daemon prio=10 tid=0xa5608 nid=0xa waiting on monitor [0..0] "Finalizer" daemon prio=8 tid=0xa1648 nid=0x7 waiting on monitor [0xfe201000..0xfe2019e0] at java.lang.Object.wait(Native Method) - waiting on <f5362370> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:108) - locked <f5362370> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:123) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162) "Reference Handler" daemon prio=10 tid=0x9fd20 nid=0x6 waiting on monitor [0xfe301000..0xfe3019e0] at java.lang.Object.wait(Native Method) - waiting on <f535e248> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:420) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110) - locked <f535e248> (a java.lang.ref.Reference$Lock) "VM Thread" prio=5 tid=0x9f0c0 nid=0x4 runnable "VM Periodic Task Thread" prio=10 tid=0xa3238 nid=0x8 runnable "Suspend Checker Thread" prio=10 tid=0xa32f0 nid=0x9 runnable The deadlock happens as follows: 1.After the drag operation completes the source list receives the input focus. 2.Corresponding FOCUS_GAINED event is posted to the Java event queue. 3.The toolkit thread (AWT-Motif) receives the notification that the drag and drop is finished. It posts an InvocationEvent to the Java event queue, so that the DragSourceListener is notified that the drag and drop is finished. Then it waits until the InvocationEvent is processed. 4.The Java event dispatch thread (AWT-EventQueue-0) gets the FOCUS_GAINED event from the Java event queue and eventually dispatches it to the FocusListener. 5.The FocusListener calls Clipboard.getContents() to retrieve the contents of the system clipboard. 6.Clipboard.getContents() starts a new selection thread (AWT-Selection) and waits until that thread gets the contents. 7.The selection thread posts a request to the selection owner and waits until the owner responds to the request. 8.The selection owner response is posted to the native event queue, which is processed by the toolkit thread. 9.The toolkit thread is blocked waiting until the InvocationEvent is processed, so at this point the three involved threads (AWT-Motif, AWT-EventQueue-0, AWT-Selection) are blocked. This hang is similar to the one documented in the evaluation for the bug #4388802. The hang is not reproducible with Java 1.4, as the Clipboard and Drag and Drop subsystems were essentially redesigned in 1.4. AWT-Selection thread was eliminated and the toolkit thread doesn't wait until InvocationEvent is processed. The hang is not reproducible with 1.3.1 on Windows, since the contents of the Windows Clipboard can be retrieved synchronously and doesn't require asynchronous request to the owner. ###@###.### 2001-11-16 ====================================================================== According to the submitter, this bug does not occur with JDK1.4. Because this bug does not occur in the current release of the JDK (1.4), it must be handled as a technical escalation through CTE, and it cannot have a priority higher than 4. Priority applies only to the current release; it is not relevant to escalations, so the lower priority will not affect the likelihood of a fix. An internal escalation for this bug can be filed at: http://jpse.eng/Home_files/CTERequest.html I'll leave this report open for the convenience of CTE. ###@###.### 2001-11-12
12-11-2001