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(
at org.eclipse.swt.widgets.Display.createDisplay(
at org.eclipse.swt.widgets.Display.create(
at org.eclipse.swt.widgets.Display.(
at org.eclipse.swt.widgets.Display.(
at org.eclipse.ui.internal.Workbench.createDisplay(
at org.eclipse.ui.PlatformUI.createDisplay(
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(
at org.eclipse.ui.internal.ide.application.IDEApplication.start(
at org.eclipse.test.UITestApplication.runApplication(

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