Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 252692

Summary: [DND] Out of memory error when starting brand new eclipse 3.4 when big amt on clipboard
Product: [Eclipse Project] Platform Reporter: Philip Schlesinger <philip.schlesinger>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: cocoakevin, emoffatt, loskutov, mlists, philip.schlesinger, pwebster
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Philip Schlesinger CLA 2008-10-29 18:03:29 EDT
Build ID: M20080911-1700

Steps To Reproduce:
(interpretation with help from krbarnes)
1. Have lots on the clipboard
2. Start eclipse
3. Pick workspace
4. Wait for error message due to PasteAction - generates stacktraces below


More information:
$ cat eclipse/eclipse.ini
-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Djava.library.path=/usr/lib/jni
-Dcom.sun.management.jmxremote
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx2048m
-XX:MaxPermSize=256m

Linux dev-007 2.6.24-21-generic #1 SMP Thu Oct 23 13:28:02 PDT 2008 x86_64 GNU/Linux

Kubuntu 8.04 running KDE 4.1.2

8 GB RAM

3.14 GHz Core2Duo

Eclipse Ganymede SR1 x86_64

Stacktrace 1:

java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at org.eclipse.ui.part.ResourceTransfer.nativeToJava(ResourceTransfer.java:162)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:308)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:240)
at org.eclipse.ui.internal.navigator.resources.actions.PasteAction$1.run(PasteAction.java:191)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:178)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4021)
at org.eclipse.ui.internal.navigator.resources.actions.PasteAction.updateSelection(PasteAction.java:186)
at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:124)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.updateActionBars(EditActionGroup.java:149)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.fillActionBars(EditActionGroup.java:95)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider.fillActionBars(EditActionProvider.java:46)
at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:239)
at org.eclipse.ui.internal.navigator.CommonNavigatorManager.selectionChanged(CommonNavigatorManager.java:220)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2062)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1138)
at org.eclipse.ui.navigator.CommonViewer.handleSelect(CommonViewer.java:388)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1168)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:227)
at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:221)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:388)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1158)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3401)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3033)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)


.xsession-errors, Eclipse on startup:
kwin: X Error (error: BadMatch [8], request: X_SetInputFocus[42], resource: 0x420005a)
X Error: BadWindow (invalid Window parameter) 3
  Major opcode:  20
  Minor opcode:  0
  Resource id:  0x420005a


.xsession-errors, Eclipse on shutdown:
X Error: BadWindow (invalid Window parameter) 3
  Major opcode:  20
  Minor opcode:  0
  Resource id:  0x420010a 

Stacktrace 2:
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: Requested array size exceeds VM limit)
at org.eclipse.swt.SWT.error(SWT.java:3777)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3378)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3036)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at org.eclipse.ui.part.ResourceTransfer.nativeToJava(ResourceTransfer.java:162)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:308)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:240)
at org.eclipse.ui.internal.navigator.resources.actions.PasteAction$1.run(PasteAction.java:191)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:178)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4021)
at org.eclipse.ui.internal.navigator.resources.actions.PasteAction.updateSelection(PasteAction.java:186)
at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:124)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.updateActionBars(EditActionGroup.java:149)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.fillActionBars(EditActionGroup.java:95)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider.fillActionBars(EditActionProvider.java:46)
at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:239)
at org.eclipse.ui.internal.navigator.CommonNavigatorManager$2.run(CommonNavigatorManager.java:104)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.ui.internal.navigator.CommonNavigatorManager$UpdateActionBarsJob.runInUIThread(CommonNavigatorManager.java:94)
at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3378)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3036)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)


eclipse.buildId=M20080911-1700
java.version=1.5.0_15
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64
Comment 1 Eric Moffatt CLA 2008-11-04 15:39:27 EST
Philip, what exactly is on the clipboard when you're starting (the code is specifically asking for ResourceTransfer...are there many IResources on the CB?
Comment 2 Eric Moffatt CLA 2008-11-04 15:40:10 EST
Accidentally reassigned, reverting back to me...
Comment 3 Philip Schlesinger CLA 2008-11-04 19:41:03 EST
(In reply to comment #1)
> Philip, what exactly is on the clipboard when you're starting (the code is
> specifically asking for ResourceTransfer...are there many IResources on the CB?
> 

Hi Eric,

I think I might know what's filling up the clipboard: autocutsel.

Eclipse hasn't given me any trouble since I stopped loading autocutsel.  I was using it in conjunction with x11vnc.
Comment 4 Eric Moffatt CLA 2008-11-05 10:02:39 EST
Philip, I'm going to close this one then. The paste action is doing the only thing it can...determining if there are resources on the clipboard.

Feel free to re-open if you think there's a more general problem...
Comment 5 Philip Schlesinger CLA 2008-11-05 13:59:06 EST
Eric, please forgive my incredulity, but I simply cannot be polite here:

In what reality do you live in that you think people would find it be acceptable for Eclipse to crash because of a heavily-loaded clipboard?  

Heck, for any program to crash because of a heavily-loaded clipboard?

That's completely idiotic - and bad coding.  You - or one of the other Eclipse programmers - needs to find a better way for Eclipse to test for available resources.  I'm certainly not the only person who codes via VNC.
Comment 6 Ismael Juma CLA 2008-11-05 14:54:24 EST
I am not familiar with the API available to the Platform, but I would say that no matter what the contents of the clipboard are, Eclipse should not crash on start-up. Ideally, it would avoid loading objects that are too large to fit in memory, but if that is not possible, it should at least catch the exception, ignore the past and continue loading.

It's just counter-intuitive for Eclipse to die before start-up due to a paste that the user has not requested.
Comment 7 Kevin Barnes CLA 2008-11-05 15:03:31 EST
I feel it necessary to point out that this is a somewhat unusual case. The crash happens when running gtk eclipse through vnc on a windows box, and using autocutsel to synchronize the clipboards between the window and linux boxes.

No paste is happening. The paste action is trying to determine if a paste is possible (by getting the contents of the clipboard) so that it can correctly set its enablement.

I agree that we should try to avoid the crash, but we need to find a way to determine the clipboard data is bogus, and find the right place to run away when it is both of which may be non-trivial decisions.
Comment 8 Philip Schlesinger CLA 2008-11-05 15:16:54 EST
(In reply to comment #7)
> I feel it necessary to point out that this is a somewhat unusual case. The
> crash happens when running gtk eclipse through vnc on a windows box, and using
> autocutsel to synchronize the clipboards between the window and linux boxes.
> 
> No paste is happening. The paste action is trying to determine if a paste is
> possible (by getting the contents of the clipboard) so that it can correctly
> set its enablement.
> 
> I agree that we should try to avoid the crash, but we need to find a way to
> determine the clipboard data is bogus, and find the right place to run away
> when it is both of which may be non-trivial decisions.
> 

Hi there.  Kevin, your note is incorrect.  

This is Kubuntu 8.04 talking to Kubuntu 8.04, not Windows talking to Kubuntu 8.04.
Comment 9 Eric Moffatt CLA 2008-11-05 15:24:49 EST
Philip, I live in a world that is a never ending stream of defects. Of the over 700 that I 'own' I'll only get to work on a few tens in a given cycle so choosing the ones with the most general benefit to the eclipse community as a whole becomes of paramount importance.

In this particular case I had an individual having a problem, said that they'd found the likely culprit and appeared to be back on track. So I closed it.

I do agree that crashing on startup is 'always bad' (tm), whatever the cause...;-).

However, if there's any hope of addressing this we're going to have to better understand the scenario. Do you know what 'autocutsel' placed on the clipboard? It makes a big difference whether or not it's actual data or just corrupt. Also, it would be very helpful if you could test whether or not you get the same failure when the PackageExplorer is used instead of the ProjectExplorer.

Finally, so you have any hints as to how we'd go about getting this issue to manifest on our machines?

Comment 10 Kevin Barnes CLA 2008-11-05 15:33:29 EST
Philip, sorry I assumed windows->linux. KDE does add a potentially interesting twist. We could look at how nicely the gtk clipboard plays with kde as part of the investigation of this bug.
Comment 11 Philip Schlesinger CLA 2008-11-05 16:11:26 EST
(In reply to comment #9)
> Philip, I live in a world that is a never ending stream of defects. Of the over
> 700 that I 'own' I'll only get to work on a few tens in a given cycle so
> choosing the ones with the most general benefit to the eclipse community as a
> whole becomes of paramount importance.
> 
> In this particular case I had an individual having a problem, said that they'd
> found the likely culprit and appeared to be back on track. So I closed it.

I understand where you're coming from, but in my case, I'd drop its priority, not close it.


> I do agree that crashing on startup is 'always bad' (tm), whatever the
> cause...;-).

Thank you :)


> However, if there's any hope of addressing this we're going to have to better
> understand the scenario. Do you know what 'autocutsel' placed on the clipboard?
> It makes a big difference whether or not it's actual data or just corrupt.

I really don't.  If memory serves me, I tried pasting into kate and got nothing - so we could be dealing with a corrupted clipboard.  Yet kate doesn't crash when one pastes in a corrupted clipboard.


> Also, it would be very helpful if you could test whether or not you get the
> same failure when the PackageExplorer is used instead of the ProjectExplorer.

I'm a bit of a n00b when it comes to that - could you please give me a step-by-step?

 
> Finally, so you have any hints as to how we'd go about getting this issue to
> manifest on our machines?

Here's our setup: 

Two fully-patched kubuntu 8.04 kde4 amd64 PCs (note: for kubuntu, their "amd64" means "amd64" or Intel's version, "emt64").  

On the "server" run the following commands:

<begin>
#!/bin/sh

x11vnc -nap -bg -many -rfbauth ~/.vnc/passwd -noxdamage -desktop "VNC ${USER}@${HOSTNAME}"|grep -Eo "[0-9]{4}">~/.vnc/port.txt

# comment out the following if you don't want a popup telling you which port you're using.
zenity --info --text="Your VNC port is `cat ~/.vnc/port.txt`"

autocutsel
<end>


On the "client" run krdc and vnc into the client.  Copy and paste something on the "client", then run eclipse x86_64 3.4 on the server.  Choose the workspace and watch the crash happen immediately or shortly after doing a few steps.
Comment 12 Andrey Loskutov CLA 2012-10-15 07:56:08 EDT
This is a dup of bug 205678
Comment 13 Eric Moffatt CLA 2012-10-15 14:40:26 EDT
Thanks Andrey !

*** This bug has been marked as a duplicate of bug 205678 ***