Friday, May 2, 2014

Speeding up file open/close in Eclipse 4.3(Kepler) on CentOS 6.5

I recently started a new job, and have been using CentOS 6.5 for my laptop while working as a QA Automation engineer.  One of the issues I have run into is that eclipse (main IDE that I use) was taking a long time to both open and close files.

Come to find out that a bug that was initially reported in 2008 is still wreaking havok, namely that gtk+ hangs when looking for network printers using CUPS.  This is significant because it doesn't just affect eclipse, but has also been reported to affect firefox, openoffice/LibreOffice, and other applications where you would want to print.

If you want to confirm that this affects you, start eclipse with the following arguements:

eclipse -vmargs -Dorg.eclipse.swt.internal.gtk.disablePrinting

then, open and close files in eclipse and observe performance.  For me, files were taking approx 10-30 seconds to open, and up to 30 seconds to close, for *every file*.  Running with this option dropped the open/close time to <= 5 sec per file.

Since this impacts more than just eclipse, I wanted to make sure this was resolved on my system.  The best workaround I have found is the following, mentioned at the debian bug report listed below.  Steps are as follows:

  1. sudo vi /etc/cups/cupsd.conf
    1. comment out "Listen /var/run/cups/cups.sock"
  2. sudo vi /etc/cups/client.conf
    1. add "ServerName 127.0.0.1"
  3. sudo service cups restart

after this, I was able to open eclipse as normal, without the -vmargs argument and without the delay in opening/closing files.  Less time waiting on the computer, more time being productive. :-)

see the links below if you are interested in the nitty gritty.

debian bug report that lists work around:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594997

eclipse bug report of the issue with the eclipse vmargs workaround
https://bugs.eclipse.org/bugs/show_bug.cgi?id=275072

linked eclipse bug with more info:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=215234

eclipse faq entry with short discussion of issue:
http://www.eclipse.org/swt/faq.php#printOnGTKHangs