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

Bug 434560

Summary: [GTK3] SWTBot makes Eclipse hang
Product: [Technology] SWTBot Reporter: Marc-André Laperle <malaperle>
Component: SWTBotAssignee: Project Inbox <swtbot-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, arunkumar.thondapu, mistria
Version: 2.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test project none

Description Marc-André Laperle CLA 2014-05-09 19:02:46 EDT
Eclipse Platform 4.4.0-I20140508-2000
Ubuntu 14.04
GTK 3.10.8-0ubuntu1
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
SWT_GTK3=1
UBUNTU_MENUPROXY=0
LIBOVERLAY_SCROLLBAR=0

When running a simple SWTBot test, Eclipse hangs forever. I am attaching a sample project that includes:
- A simple SWTBot test
- A target definition that uses Eclipse 4.4 integration builds and SWTbot latest stable
- A launch configuration file

If I look in my /proc/pid/maps, I can see both GTK2 (libgtk-x11-2.0.so) and GTK3 (libgtk-3.so) loaded so that must be the reason. I'll investigate further.

This might be another manifestation of bug 431330.
Comment 1 Marc-André Laperle CLA 2014-05-09 19:50:17 EDT
Created attachment 242918 [details]
test project
Comment 2 Marc-André Laperle CLA 2014-05-09 20:09:59 EDT
Indeed, in SWTBot, AWT is used and it loads GTK2. With the Oracle JDK (tested version 8) this problem is not present.
Comment 3 Marc-André Laperle CLA 2014-05-09 20:17:26 EDT
To verify this, I removed the AWT code from SWTBot and it worked on openjdk. But it doesn't look easy to remove this cleanly so it might be better to fix this in openjdk.
Comment 4 Mickael Istria CLA 2014-05-10 11:36:36 EDT
@Marc-Andre: did you identify which parts of SWTBot depend on AWT? Ideally, it would make a lot of sense to simply avoid using AWT APIs in SWTBot. However, we need to evaluate whether it's really possible.
I know for example that javax.awt.Robot is used for some drag'n'drops. If we can implement the same thing with SWT, let's do this, but I'm not sure of a good way to do this.
Comment 5 Marc-André Laperle CLA 2014-05-10 13:00:03 EDT
I did a grep for .awt. and this came up:

./org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayoutFilter.java:13:import java.awt.im.InputContext;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTBotPreferences.java:15:import java.awt.im.InputContext;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactory.java:13:import java.awt.Robot;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/AWTKeyboardStrategy.java:13:import java.awt.AWTException;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/AWTKeyboardStrategy.java:14:import java.awt.Robot;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/AWTKeyboardStrategy.java:15:import java.awt.event.KeyEvent;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java:19:import java.awt.AWTException;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java:20:import java.awt.Robot;
./org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java:21:import java.awt.event.InputEven

So yeah, it's mostly drag and drop and input code. Since the attached test code doesn't use drag and drop or keyboard, I was able to quickly test by removing it all.
Comment 6 Alexander Kurtakov CLA 2014-05-14 04:55:34 EDT
Marc, this looks as a duplicate of bug 431330.
AWT loads GTK2 only if Gnome L'n'F (verified with Oracle JDK on Ubuntu and with OpenJDK on RHEL/Fedora) so setting the L'n'F to something else would prevent the crash. For some reason OpenJDK on Ubuntu loads Gnome L'n'F always (haven't tested it myself, swt bug reports claim so) so I don't have a recommendation for this case.
Comment 7 Arun Thondapu CLA 2014-05-14 06:44:01 EDT
(In reply to Alexander Kurtakov from comment #6)
> For some reason OpenJDK on Ubuntu loads Gnome L'n'F
> always (haven't tested it myself, swt bug reports claim so) so I don't have
> a recommendation for this case.

A minor correction - OpenJDK (IcedTea) does not load Gnome L'n'F always, instead it loads GTK+ 2 regardless of the L'n'F mode used (which is probably what was meant above too but just to clarify it better).
Comment 8 Marc-André Laperle CLA 2014-05-14 14:06:35 EDT
(In reply to Alexander Kurtakov from comment #6)
> Marc, this looks as a duplicate of bug 431330.

Yes, sorry I should have marked it as such to me more clear.

*** This bug has been marked as a duplicate of bug 431330 ***