org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

5.8k Views Asked by At

I am trying to use eclipse MAT tool on Linux (ubuntu 18.04) and getting the below error:

root@xxx/var/lib/jenkins/workspace/Heap_Analysis/mat# ./MemoryAnalyzer
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
MemoryAnalyzer: Cannot open display:
MemoryAnalyzer:
An error has occurred. See the log file
/var/lib/jenkins/workspace/Heap_Analysis/mat/configuration/1614805252582.log.
root@xxxx:/var/lib/jenkins/workspace/Heap_Analysis/mat# cat /var/lib/jenkins/workspace/Heap_Analysis/mat/configuration/1614805252582.log
!SESSION 2021-03-03 21:00:52.492 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.10
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2021-03-03 21:00:53.259
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
        at org.eclipse.swt.SWT.error(SWT.java:4749)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:1130)
        at org.eclipse.swt.widgets.Display.create(Display.java:1070)
        at org.eclipse.swt.graphics.Device.<init>(Device.java:175)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:636)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:627)

If you guys know of any way to fix the issue, would appreciate it.

Have already gone through all the similar issues on stackoverflow and also the below link: https://unix.stackexchange.com/questions/94497/org-eclipse-swt-swterror-no-more-handles-gtk-init-check-failed-while-runnin

But nothing helped.

1

There are 1 best solutions below

0
On BEST ANSWER

I haven't seen this problem myself, but:

  1. Check that you have libwebkit2gtk-4.0 installed
  2. Check that DISPLAY is set correctly
  3. Check that you can get other X applications to work
  4. Try the latest Memory Analyzer, version 1.12 as that is based on a more recent version of Eclipse, 2021-06
  5. I can run MAT under Docker on Windows with an Ubuntu 18.04 based image, so Ubuntu 18.04 can work: Running MAT under Docker