Sunday, June 27, 2010

No more handles?

I manage 4 Eclipse PDE builds on two different build servers. Three days ago, I started getting this same exception when running the JUnit tests for all 4 of the builds:

org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(SWT.java:3910)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:863)
at org.eclipse.swt.widgets.Display.create(Display.java:851)
at org.eclipse.swt.graphics.Device.(Device.java:152)
at org.eclipse.swt.widgets.Display.(Display.java:479)
at org.eclipse.swt.widgets.Display.(Display.java:470)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:532)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:143)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:88)
at org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:138)
at org.eclipse.test.UITestApplication.run(UITestApplication.java:60)
...


I was pulling my hair out trying to figure out why all four builds would be failing in the same exact way even though they span Eclipse versions (Galileo and Helios), and servers. All links I could track down seemed to imply that the root cause are SWT resources that are not properly disposed.

It turns out that solution was a bit more banal than that. There were no leaks in my code. Instead, this exception occurred because there was no virtual display available on the build servers for running the UI tests. Xvfb had shut down. After a restart of Xvfb, the tests are now running as expected.

Now, why Xvfb would happen to shut down on both servers at the same time still befuddles me, but the problem is fixed. I just hope that the next person who sees this problem doesn't also immediately think there is a resource leak, and pull their hair out to find it.

No comments:

Post a Comment