-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2
-
None
-
mantis
-
generic
-
generic
Name: dsR10078 Date: 10/09/2002
###@###.###
The bug can be reproduced on Solaris/Linux with the following test case:
----------------------------------------------------------------------------
import java.awt.*;
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
Toolkit tk = Toolkit.getDefaultToolkit();
Clipboard c1 = null;
Clipboard c2 = null;
if (args.length == 0) {
c1 = tk.getSystemClipboard();
c2 = tk.getSystemSelection();
} else {
c1 = tk.getSystemSelection();
c2 = tk.getSystemClipboard();
}
final Clipboard clipboard = c2;
final Transferable t = new StringSelection("TEXT");
c1.setContents(t, null);
for (int i = 0; i < 100; i++) {
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
Transferable t = clipboard.getContents(null);
try {
System.err.println("data=" +
t.getTransferData(DataFlavor.stringFlavor));
} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
System.err.println("i=" + i);
}
}
}
----------------------------------------------------------------------------
Steps to reproduce:
1.Compile the test case.
2.Run simultaneosly two instances of this test - one with an arbitrary command-line
argument and the other without any arguments. For example:
# java Test 1
# java Test
3.Note that they start printing to the console and then both get blocked.
The thread dump at the point of deadlock is as follows:
----------------------------------------------------------------------------
Full thread dump Java HotSpot(TM) Client VM (1.4.2-beta-b02 mixed mode):
"AWT-EventQueue-0" prio=1 tid=0x081cee30 nid=0x7b14 in Object.wait() [41617000..416178cc]
at java.lang.Object.wait(Native Method)
- waiting on <0x4828ee40> (a java.lang.Class)
at sun.awt.datatransfer.ClipboardTransferable.getClipboardData(Native Method)
at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:106)
at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:80)
at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:96)
- locked <0x441d0308> (a sun.awt.motif.X11Clipboard)
at Test$1.run(Test.java:23)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:449)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
"AWT-Motif" daemon prio=1 tid=0x081be6a0 nid=0x7b12 in Object.wait() [41595000..415968cc]
at java.lang.Object.wait(Native Method)
- waiting on <0x4828ee40> (a java.lang.Class)
at sun.awt.motif.MToolkitThreadBlockedHandler.enter(Native Method)
at sun.awt.datatransfer.DataTransferer.convertData(DataTransferer.java:2026)
at sun.awt.motif.MToolkit.run(Native Method)
at java.lang.Thread.run(Thread.java:536)
"AWT-Shutdown" prio=1 tid=0x081be328 nid=0x7b10 in Object.wait() [41515000..415158cc]
at java.lang.Object.wait(Native Method)
- waiting on <0x4464c288> (a java.lang.Object)
at java.lang.Object.wait(Object.java:426)
at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
- locked <0x4464c288> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:536)
"Signal Dispatcher" daemon prio=1 tid=0x08093648 nid=0x7b0b waiting on condition [0..0]
"Finalizer" daemon prio=1 tid=0x0808e588 nid=0x7b01 in Object.wait() [40bdb000..40bdb8cc]
at java.lang.Object.wait(Native Method)
- waiting on <0x44645448> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <0x44645448> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=1 tid=0x0808cad8 nid=0x7b00 in Object.wait() [40b5a000..40b5a8cc]
at java.lang.Object.wait(Native Method)
- waiting on <0x446454b0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <0x446454b0> (a java.lang.ref.Reference$Lock)
"main" prio=1 tid=0x08051ef8 nid=0x7afd in Object.wait() [bfffc000..bfffce88]
at java.lang.Object.wait(Native Method)
- waiting on <0x44145f60> (a java.awt.EventQueue$1$AWTInvocationLock)
at java.lang.Object.wait(Object.java:426)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:824)
- locked <0x44145f60> (a java.awt.EventQueue$1$AWTInvocationLock)
at Test.main(Test.java:21)
"VM Thread" prio=1 tid=0x080898f8 nid=0x7aff runnable
"VM Periodic Task Thread" prio=1 tid=0x08092168 nid=0x7b07 waiting on condition
"Suspend Checker Thread" prio=1 tid=0x08092bd8 nid=0x7b09 runnable
----------------------------------------------------------------------------
This behavior was introduced with the fix for 4558797.
Before that fix the deadlock is not reproducible, but the two apps continuously throw
IOExceptions reporting data conversion failure:
----------------------------------------------------------------------------
java.io.IOException: Failed to get selection targets
at sun.awt.datatransfer.ClipboardTransferable.getClipboardData(Native Method)
at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:106)
at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:80)
at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:96)
at Test$1.run(Test.java:23)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:449)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
----------------------------------------------------------------------------
###@###.### 2002-10-09
======================================================================
- relates to
-
JDK-4558797 "Copy" operation fails when using "xclipboard"
-
- Resolved
-