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

Bug 323316

Summary: XSL source editing eats GDI handles and may lead to a 'No more handles' exception
Product: [WebTools] WTP Source Editing Reporter: David Carver <d_a_carver>
Component: wst.xslAssignee: David Carver <d_a_carver>
Status: RESOLVED FIXED QA Contact: David Carver <d_a_carver>
Severity: critical    
Priority: P3 CC: eclipse, info, jesper, m_hess, nsand.dev, thatnitind
Version: unspecified   
Target Milestone: 3.2.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 319226    
Bug Blocks:    

Description David Carver CLA 2010-08-21 19:25:03 EDT
+++ This bug was initially created as a clone of Bug #319226 +++

Build Identifier: 20100617-1415

I recently downloaded and installed Eclipse Helios for PHP developers to work with some xsl files. I'm running the Windows 64 Bit version on Windows 7 and JDK 1.6.0_21 (x64).

During a few hours work I got several crashes where Eclipse either freezed or just died. In the log file I could find exceptions like the following:

!ENTRY org.eclipse.ui 4 4 2010-07-08 08:41:05.539
!MESSAGE An internal error has occurred.
!STACK 0
org.eclipse.swt.SWTError: No more handles
	at org.eclipse.swt.SWT.error(SWT.java:4109)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Display.internal_new_GC(Display.java:2589)
	at org.eclipse.swt.graphics.Device.getDepth(Device.java:447)
	at org.eclipse.swt.custom.CTabFolder.setSelectionBackground(CTabFolder.java:2857)
	at org.eclipse.ui.internal.presentations.PaneFolder.setSelectionBackground(PaneFolder.java:772)
	at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.updateColors(DefaultTabFolder.java:468)
	at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.setActive(DefaultTabFolder.java:420)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.setActive(TabbedStackPresentation.java:372)
	at org.eclipse.ui.internal.DefaultStackPresentationSite.setActive(DefaultStackPresentationSite.java:55)
	at org.eclipse.ui.internal.PartStack.setActive(PartStack.java:1183)
	at org.eclipse.ui.internal.EditorPane.showFocus(EditorPane.java:140)
	at org.eclipse.ui.internal.WorkbenchPage.deactivatePart(WorkbenchPage.java:1731)
	at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3523)
	at org.eclipse.ui.internal.WorkbenchPage.makeActive(WorkbenchPage.java:1244)
	at org.eclipse.ui.internal.WorkbenchPage.onDeactivate(WorkbenchPage.java:2642)
	at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2972)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2967)
	at org.eclipse.ui.internal.WorkbenchWindow.closeAllPages(WorkbenchWindow.java:849)
	at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1696)
	at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:734)
	at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:710)
	at org.eclipse.ui.internal.WorkbenchWindow$5.run(WorkbenchWindow.java:826)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:824)
	at org.eclipse.jface.window.WindowManager.close(WindowManager.java:109)
	at org.eclipse.ui.internal.Workbench$18.run(Workbench.java:1105)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:1102)
	at org.eclipse.ui.internal.Workbench.access$15(Workbench.java:1031)
	at org.eclipse.ui.internal.Workbench$25.run(Workbench.java:1275)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.Workbench.close(Workbench.java:1273)
	at org.eclipse.ui.internal.WorkbenchConfigurer.emergencyClose(WorkbenchConfigurer.java:165)
	at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.closeWorkbench(IDEWorkbenchErrorHandler.java:253)
	at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.handleException(IDEWorkbenchErrorHandler.java:155)
	at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.access$0(IDEWorkbenchErrorHandler.java:146)
	at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler$1.runInUIThread(IDEWorkbenchErrorHandler.java:121)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:369)
	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:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

I opened the Task Manager in Windows and kept an eye on the GDI Object count as I once again started up Eclipse to see what was wrong with it. It was then I realise that whenever I am editing an xsl file (using either the XSL Editor or XML Editor), the GDI Object counter increased with at least one for each and every key press. It seems that when I use the PHP perspective, each key press results in one extra GDI object, but when I use the XML perspective, each key press results in about three extra GDI objects.

Eventually the GDI objects reaches the limit of 10000 and Eclipse either freezes och crashes depending on the state it is in when reaching the limit.

I cannot see the same behaviour when editing xml files or when editing xsl using the plain text editor.

Reproducible: Always

Steps to Reproduce:
1. Create a new xsl file
2. Open the xsl file with the XSL Editor
3. Write anything in the xsl file. Each added character will increase the number of allocated GDI objects. (Switch to the XML perspective to make the GDI allocation increase even faster)
4. Keep writing until the number of GDI objects reaches the upper limit for a process, i.e 10000 in Windows 7.
5. Eclipse will freeze or crash.
Comment 1 David Carver CLA 2010-08-21 19:29:19 EDT
Released patch from bug 319226 into 3.2.2 maintenance release.