This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 40693 - the IDE hangs on accessing clipboard
Summary: the IDE hangs on accessing clipboard
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: _ ttran
URL:
Keywords: THREAD
: 40346 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-02 16:51 UTC by ehucka
Modified: 2008-12-22 20:49 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Threads dump. (8.22 KB, text/plain)
2004-03-02 16:53 UTC, ehucka
Details
NBClipboard part of the workaround (4.18 KB, patch)
2004-03-04 12:55 UTC, _ ttran
Details | Diff
This patch convinces all Swing text components to use ExClipboard instead of Toolkit.getSystemClipboard, works on 1.4 and 1.5beta, test is not finished yet (8.30 KB, patch)
2004-03-04 13:30 UTC, Jaroslav Tulach
Details | Diff
my and yarda's combined patch against release36 (9.63 KB, patch)
2004-03-04 14:30 UTC, _ ttran
Details | Diff
Enhanced patch to also address issue 40785 (10.81 KB, patch)
2004-03-07 09:58 UTC, Jaroslav Tulach
Details | Diff
Additional fix of issue 40820 (10.71 KB, patch)
2004-03-08 10:06 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2004-03-02 16:51:22 UTC
Dev Build 200402261900

Next amazing deadlock.
I've worked in IDE than I switched to another
application (mozilla), close it and return to IDE.
There I tried to close an editor tab and IDE was
blocked (data was lost).
If I remember I didn't use clipboard between IDE
and other applications.
Comment 1 ehucka 2004-03-02 16:53:42 UTC
Created attachment 13774 [details]
Threads dump.
Comment 2 _ ttran 2004-03-02 23:00:24 UTC
had you used debugger before the deadlock happened?  Also see JDK bug
4818143.

You also forgot to meantion OS platform and JDK version
Comment 3 ehucka 2004-03-03 08:32:07 UTC
I forgot to notice I didn't use debugger in that IDE run.
And in threaddump made immediately after the deadlock the
'AWT-EventQueue-1' thread was still running but CPU was not used (to
5%). Here I've attached next threaddump.


JDK 1.4.2_03, RadHat 9 Gnome 2.2
Comment 4 _ ttran 2004-03-03 11:57:41 UTC
this is a confirmed bug in AWT

http://developer.java.sun.com/developer/bugParade/bugs/4818143.html

We can't do anything about it in our code base.  See also issue 40346,
a different manifestation of the same AWT bug.
Comment 5 _ ttran 2004-03-04 12:09:02 UTC
I am reopening this bug, have a workaround prepared, will commit shortly
Comment 6 _ ttran 2004-03-04 12:55:38 UTC
Created attachment 13820 [details]
NBClipboard part of the workaround
Comment 7 _ ttran 2004-03-04 13:07:16 UTC
Reliable steps to reproduce the hang on Unix:

1) run any app on X (say mozilla, or JDK Notepad java demo) from the
console

2) in that app, select some text, copy it into the clipboard

3) switch to the console, press Ctrl-Z to suspend the app

4) switch to the IDE, it will hangs

5) if not (after nbclipboard hack attached) pressing Ctrl+V in the NB
editor will cause the IDE to hang

Issue 40346, debugging the app which owns the clipboard, is only a
special case of how the clipboard owner is suspended




Comment 8 _ ttran 2004-03-04 13:11:25 UTC
my fix in NbClipboard:  i call into the system clipboard from a
separate thread, in the worst case only that thread will hang, not the
whole IDE.  After that point the IDE will ignore the system clipboard
completely, no copy/paste b/w the IDE and the external app is
possible.  It's the best we can achieve
Comment 9 Jaroslav Tulach 2004-03-04 13:30:20 UTC
Created attachment 13822 [details]
This patch convinces all Swing text components to use ExClipboard instead of Toolkit.getSystemClipboard, works on 1.4 and 1.5beta, test is not finished yet
Comment 10 _ ttran 2004-03-04 14:25:11 UTC
fixed in trunk
Comment 11 _ ttran 2004-03-04 14:30:49 UTC
Created attachment 13824 [details]
my and yarda's combined patch against release36
Comment 12 _ ttran 2004-03-04 14:33:14 UTC
patch against release36 to work around the AWT bug attached.  yarda
and i reviewed each other's patch.  consider this reviewed.  We also
tested all the scenerios we know how to hang the IDE and how clipboard
is used in the IDE.  Appreciate if someone from QA can verify
independently
Comment 13 Maros Sandor 2004-03-04 14:59:32 UTC
*** Issue 40346 has been marked as a duplicate of this issue. ***
Comment 14 _ ttran 2004-03-05 14:49:52 UTC
the fix seems to trigger bug 40785
Comment 15 Marian Mirilovic 2004-03-06 19:57:56 UTC
Eman,
could you verify in trunk , 
thanks in advance.

(I am sorry but I can't reproduce it in NB3.6)
Comment 16 Jaroslav Tulach 2004-03-07 09:58:49 UTC
Created attachment 13858 [details]
Enhanced patch to also address issue 40785
Comment 17 Jaroslav Tulach 2004-03-08 10:06:27 UTC
Created attachment 13866 [details]
Additional fix of issue 40820
Comment 18 ehucka 2004-03-08 10:29:30 UTC
Verified in 200403071900.
Comment 19 Jaroslav Tulach 2004-03-08 13:47:15 UTC
Backported to 3.6:

/cvs/openide/src/org/openide/util/datatransfer/ExTransferable.java,v 
<--  ExTransferable.java
new revision: 1.19.118.1; previous revision: 1.19
done
Processing log script arguments...
More commits to come...
Checking in core/bootstrap/src/org/netbeans/TopSecurityManager.java;
/cvs/core/bootstrap/src/org/netbeans/TopSecurityManager.java,v  <-- 
TopSecurityManager.java
new revision: 1.6.52.1; previous revision: 1.6
done
Processing log script arguments...
More commits to come...
Checking in core/src/org/netbeans/core/NbClipboard.java;
/cvs/core/src/org/netbeans/core/NbClipboard.java,v  <--  NbClipboard.java
new revision: 1.13.2.1; previous revision: 1.13
done
Checking in core/src/org/netbeans/core/NonGui.java;
/cvs/core/src/org/netbeans/core/NonGui.java,v  <--  NonGui.java
new revision: 1.103.4.1; previous revision: 1.103