Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 33028 - hang in clipboard get contents [reorg] [ccp] [dnd]
Summary: hang in clipboard get contents [reorg] [ccp] [dnd]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux-GTK
: P2 major with 1 vote (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Adam Kiezun CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 36175 39898 41076 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-25 12:08 EST by Klaasjan Brand CLA
Modified: 2020-04-30 08:05 EDT (History)
6 users (show)

See Also:


Attachments
kill -3 on the jvm hosting a locked up eclipse (7.91 KB, text/plain)
2003-02-25 12:09 EST, Klaasjan Brand CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Klaasjan Brand CLA 2003-02-25 12:08:47 EST
All the 2.1 GTK builds of the last few months seem to hang/deadlock some of the
time. This is on a Redhat 7.3 system with updates GTK 2.0 to the latest version.
The problem seems to occur especially when Eclipse is not used for some time or
when opening a file or doing a CVS update.
Comment 1 Klaasjan Brand CLA 2003-02-25 12:09:31 EST
Created attachment 3696 [details]
kill -3 on the jvm hosting a locked up eclipse
Comment 2 Veronika Irvine CLA 2003-02-27 17:11:04 EST
Two nested calls to get the clipboard contents.

Klassjan,
It appears you are pasting something and then close a dialog - looks like a 
refactoring operation.
Can you describe the steps you were doing at the time?


Relevant part of stack trace:

	at org.eclipse.swt.internal.gtk.OS.gtk_clipboard_wait_for_contents
(Native Method)
	- locked <0x585d4760> (a java.lang.Class)
	at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:146)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.getClipboar
dResources(PasteResourcesFromClipboardAction.java:195)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.canOperateO
n(PasteResourcesFromClipboardAction.java:105)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.selectionCh
anged(PasteResourcesFromClipboardAction.java:49)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(SelectionDispatchAction.java:181)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(SelectionDispatchAction.java:176)
	at org.eclipse.jdt.internal.ui.reorg.DualReorgAction.selectionChanged
(DualReorgAction.java:40)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:153)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged
(Viewer.java:151)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection
(StructuredViewer.java:1287)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect
(StructuredViewer.java:654)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected
(StructuredViewer.java:678)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent
(OpenStrategy.java:172)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:167)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:302)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:897)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1507)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1324)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:577)
	at org.eclipse.jface.window.Window.open(Window.java:557)
	at org.eclipse.ui.internal.dialogs.MessageDialogWithToggle.openConfirm
(MessageDialogWithToggle.java:144)
	at org.eclipse.ui.internal.WorkbenchWindow.canHandleShellCloseEvent
(WorkbenchWindow.java:439)
	at org.eclipse.jface.window.Window$2.shellClosed(Window.java:448)
	at org.eclipse.swt.widgets.TypedListener.handleEvent
(TypedListener.java:152)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:897)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:922)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:906)
	at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:424)
	at org.eclipse.swt.widgets.Shell.gtk_delete_event(Shell.java:624)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1134)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:1917)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Native Method)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:577)
	at org.eclipse.swt.internal.gtk.OS.gtk_clipboard_wait_for_contents
(Native Method)
	- locked <0x585d4760> (a java.lang.Class)
	at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:146)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.getClipboar
dResources(PasteResourcesFromClipboardAction.java:195)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.canOperateO
n(PasteResourcesFromClipboardAction.java:105)
	at 
org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.selectionCh
anged(PasteResourcesFromClipboardAction.java:49)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(SelectionDispatchAction.java:181)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(SelectionDispatchAction.java:176)
	at org.eclipse.jdt.internal.ui.reorg.DualReorgAction.selectionChanged
(DualReorgAction.java:40)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:153)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged
(Viewer.java:151)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection
(StructuredViewer.java:1287)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect
(StructuredViewer.java:654)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected
(StructuredViewer.java:678)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent
(OpenStrategy.java:172)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:167)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:302)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:897)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1507)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1324)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:845)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 3 Klaasjan Brand CLA 2003-02-28 03:10:16 EST
That's the strange thing, this happens sometimes without doing anything in
Eclipse at all, just having it running and doing other things. When I switch
focus back to Eclipse it hangs.
The X clipboard is of course very "active"; by selecting something it's put on
the clipboard. Could be that Eclipse is confused by this clipboard activity?

Btw. system is Redhat7.3+all updates with xinerama (multi-head) enabled.
Comment 4 Veronika Irvine CLA 2003-03-12 13:39:20 EST
Can you report the results of the following:

rpm -q atk gtk2 glib freetype pango

SWT requires the following:

Gtk 2.0.6-1 
Atk 1.0.1-1 
Glib 2.0.4-1 
Pango 1.0.3-2 
Freetype 2.1.2 


Older versions of the GTK library (e.g. GTK 2.0.5) have threading issues would 
could be causing the problem.
Comment 5 Klaasjan Brand CLA 2003-03-12 16:15:50 EST
Seems I've got most of them up to date.

atk-1.0.3-1
gtk2-2.0.9-1
glib2-2.0.7-1
freetype-2.0.9-2gtk
pango-1.0.1-1

I'll update Freetype/pango anyway and let you know if something's changed.
However, with the current Eclipse 2.1 RC2 I've got all kinds of interesting hard
to reproduce problems on this configuration (much less on rh8), so I'm planning
to upgrade this system.
Comment 6 Steve Northover CLA 2003-03-25 12:12:39 EST
Downgrading to P2 for now because no one else is seeing the problem.  This 
doesn't mean we believe the problem is fixed but there is nothing we can do 
now for 2.1.

Several things.  First of all, thanks to GTK for the "free event loop" with 
every gtk_clipboard_wait_for_contents().  Very helpful to have UI events 
dispatched here!  Given that this is happening, I see in the stack trace we 
are running stacked event loops in this call.

VI to construct a simple case.  Try Thread.sleep() before getting the 
clipboard contents and "clicking like mad" to ensure that events are queued 
for gtk_clipboard_wait_for_contents() to dispatch.
Comment 7 Veronika Irvine CLA 2003-04-16 09:47:46 EDT
*** Bug 36175 has been marked as a duplicate of this bug. ***
Comment 8 Veronika Irvine CLA 2003-07-15 14:02:02 EDT
*** Bug 39223 has been marked as a duplicate of this bug. ***
Comment 9 Veronika Irvine CLA 2003-07-17 12:25:31 EDT
The error is in:

org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.getClipboar
dResources(PasteResourcesFromClipboardAction.java:195)

This is code is calling Clipboard.getContents from a thread other than the UI 
thread.  GTK runs an OS event loop when the contents of the clipboard are 
requested.  This can only be done in the UI thread.  As a result, I have added 
a check to the Clipboard API to ensure that it is being called from the UI 
thread.

In >M2, this will result in an invalid thread access exception.  Please update 
your code to call all Clipboard API from the UI thread.
Comment 10 Dirk Baeumer CLA 2003-07-17 12:46:26 EDT
Adam, please adjust the code accordingly. Veronika, are you going to backport 
this to 2.x stream. If so we have to fix it there as well.
Comment 11 Veronika Irvine CLA 2003-07-17 13:10:16 EDT
I am not going to back port this to 2.x.
Comment 12 Veronika Irvine CLA 2003-07-17 14:11:43 EDT
*** Bug 39898 has been marked as a duplicate of this bug. ***
Comment 13 Veronika Irvine CLA 2003-07-17 14:13:01 EDT
In bug 39898, the same problem is occurring but with:

 at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.canOperateOn
(PasteAction.java:92)
Comment 14 Adam Kiezun CLA 2003-07-21 08:33:30 EDT
fixed
Comment 15 Veronika Irvine CLA 2003-07-25 11:51:52 EDT
*** Bug 40740 has been marked as a duplicate of this bug. ***
Comment 16 Veronika Irvine CLA 2003-08-05 11:09:54 EDT
*** Bug 41076 has been marked as a duplicate of this bug. ***
Comment 17 Josh Rehman CLA 2003-08-05 15:10:25 EDT
Forgive my impertenance, but why is this bug only a P2? I can only guess as to
the number of Eclipse/Linux/GTK users, but I imagine that the number is large.
This problem is so severe, in fact, that I personally have started to feel a
little "gun shy" with Eclipse. Anything that erodes user confidence in the
stability of the tool should get a P1, IMHO.

No matter how you decide on this matter, thanks for your hard work and for
producing a wonderful tool!
Comment 18 Dani Megert CLA 2003-08-27 06:35:55 EDT
Josh, see comment 6 ;-)
Comment 19 Dani Megert CLA 2003-08-27 06:36:19 EDT
verified in I20030826-rebuild