Bug 419729 - [Ubuntu] Native crash in OS._gtk_widget_show when creating RADIO MenuItem with UBUNTU_MENUPROXY
Summary: [Ubuntu] Native crash in OS._gtk_widget_show when creating RADIO MenuItem wit...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.4   Edit
Hardware: PC Linux-GTK
: P3 critical with 25 votes (vote)
Target Milestone: 4.6 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 420499 449031 457512 462002 465485 466326 (view as bug list)
Depends on:
Blocks: 461311
  Show dependency tree
 
Reported: 2013-10-17 11:09 EDT by Thomas Singer CLA
Modified: 2019-07-18 04:05 EDT (History)
33 users (show)

See Also:


Attachments
crash log (90.18 KB, application/octet-stream)
2013-10-17 11:09 EDT, Thomas Singer CLA
no flags Details
crash log (69.99 KB, text/x-log)
2013-10-18 06:51 EDT, Thomas Singer CLA
no flags Details
crash log (63.53 KB, text/x-log)
2013-10-18 06:51 EDT, Thomas Singer CLA
no flags Details
crash log (63.02 KB, text/x-log)
2013-10-18 06:51 EDT, Thomas Singer CLA
no flags Details
crash log (91.39 KB, text/x-log)
2014-06-06 11:39 EDT, Fabien Toral CLA
no flags Details
full log (129.06 KB, text/plain)
2014-08-18 14:10 EDT, Kamil Khamitov CLA
no flags Details
Additional crash log (177.22 KB, text/x-log)
2014-10-13 06:11 EDT, Tom Deering CLA
no flags Details
Short SWT snippet that reproduces the problem (1.64 KB, text/x-java)
2015-05-27 13:13 EDT, Stefan Xenos CLA
no flags Details
crash log (141.68 KB, text/plain)
2015-06-24 13:59 EDT, Thomas Singer CLA
no flags Details
Patch (1005 bytes, patch)
2015-09-04 09:33 EDT, Taehoon Kwak CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Singer CLA 2013-10-17 11:09:48 EDT
Created attachment 236604 [details]
crash log

A user on Linux reported native crashs for SmartSVN (SWT-based application):

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.gtk.OS._gtk_widget_show(J)V+0
j  org.eclipse.swt.internal.gtk.OS.gtk_widget_show(J)V+8
j  org.eclipse.swt.widgets.MenuItem.createHandle(I)V+249
j  org.eclipse.swt.widgets.Widget.createWidget(I)V+2
j  org.eclipse.swt.widgets.MenuItem.<init>(Lorg/eclipse/swt/widgets/Menu;I)V+19
Comment 1 Thomas Singer CLA 2013-10-18 02:47:03 EDT
The version.txt file inside the swt.jar shows "version 4.331".
Comment 2 Thomas Singer CLA 2013-10-18 02:55:08 EDT
Ubuntu 13.10
Comment 3 Alexander Kurtakov CLA 2013-10-18 02:56:06 EDT
Is there any chance that you can give a snippet to reproduce the problem?
Comment 4 Thomas Singer CLA 2013-10-18 06:51:04 EDT
Created attachment 236645 [details]
crash log
Comment 5 Thomas Singer CLA 2013-10-18 06:51:22 EDT
Created attachment 236646 [details]
crash log
Comment 6 Thomas Singer CLA 2013-10-18 06:51:54 EDT
Created attachment 236647 [details]
crash log
Comment 7 Thomas Singer CLA 2013-10-18 06:53:46 EDT
The crashes happen after completely different steps, the last crash occurred directly after starting while the splash screen was showing. Following errors are locked multiple times to the console:

(SmartGit/Hg:18473): GLib-GObject-CRITICAL **: g_closure_add_invalidate_notifier: assertion 'closure->n_inotifiers < CLOSURE_MAX_N_INOTIFIERS' failed
Comment 8 Alexander Kurtakov CLA 2013-10-18 07:02:33 EDT
Thomas, I'm asking for some small pure Swt code snippet runnable separately (aka class with main method) that shows the problem. The crash and the invalidate notifier are not related (me is 99% sure) and it's discussed in bug 407077.
Comment 9 Thomas Singer CLA 2013-10-18 10:33:10 EDT
Please try following code:

		final Display display = new Display();

		final Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		final Menu menuBar = new Menu(shell, SWT.BAR);
		final MenuItem fileMenuBarItem = createMenuItem(SWT.CASCADE, "File", menuBar);
		final Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
		fileMenuBarItem.setMenu(fileMenu);
		shell.setMenuBar(menuBar);

		shell.addListener(SWT.Activate, new Listener() {
			@Override
			public void handleEvent(Event event) {
				System.err.println("rebuilding menu");

				final MenuItem[] items = fileMenu.getItems();
				for (MenuItem item : items) {
					item.dispose();
				}

				createMenuItem(SWT.PUSH, "Push", fileMenu);
				createMenuItem(SWT.CHECK, "Check", fileMenu);
				createMenuItem(SWT.RADIO, "Radio", fileMenu);
			}
		});

		final Menu menu = new Menu(shell, SWT.POP_UP);
		createMenuItem(SWT.PUSH, "Push", menu);
		createMenuItem(SWT.CHECK, "Check", menu);
		createMenuItem(SWT.RADIO, "Radio", menu);

		final Button button = new Button(shell, SWT.PUSH);
		button.setText("Click Me");
		button.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
				final Point location = display.map(button.getParent(), null, button.getLocation());
				final Point size = button.getSize();
				menu.setLocation(location.x, location.y + size.y);
				menu.setVisible(true);
			}
		});

		shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		menu.dispose();
		display.dispose();


And open some other windows, especially dialogs, click the button.
Comment 10 Alexander Kurtakov CLA 2013-10-18 10:37:15 EDT
Missed the createMenuItem method?
Comment 11 Thomas Singer CLA 2013-10-18 10:44:55 EDT
Sorry:

	private static MenuItem createMenuItem(int style, String text, Menu menu) {
		final MenuItem item = new MenuItem(menu, style);
		item.setText(text);
		return item;
	}
Comment 12 Alexander Kurtakov CLA 2013-10-18 11:02:42 EDT
I played with it a lot but wasn't able to reproduce on fedora 19 system (gtk 2.24.22). Does it crash for your everytime you do certain action? Can you simulate the crash in the snippet?
Comment 13 Thomas Singer CLA 2013-10-18 11:15:17 EDT
I only can reproduce the problem on Ubuntu 13.10, not on Ubuntu 12.04. It only has us been reported against Ubuntu 13.10, not against previous versions, though the code has not changed there for a long time. I guess, there is something specific in Ubuntu 13.10 which may not be reproducible on other systems.
Comment 14 Thomas Singer CLA 2013-10-21 05:05:48 EDT
According to https://twitter.com/md__5/status/391352267313405952 the bug seems to be related to UBUNTU_MENUPROXY.
Comment 15 Alexander Kurtakov CLA 2013-10-21 05:16:42 EDT
Further investigations would need to be done by someone having the time to install and test the Ubuntu version in question. I don't have such time but I would be happy to review a patch if provided.
Comment 16 Quinn Balazs CLA 2013-10-22 14:03:40 EDT
This bug has been filed in Launchpad (Ubuntu Bug Tracker) as lp#1241101, filed against the java-common package in Ubuntu. 

User using Ubuntu 13.10 has reported crashes using SmartGit v4.6.4

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fa59061f9c0, pid=12494, tid=140349308167936
#
# JRE version: 7.0_25-b30
# Java VM: OpenJDK 64-Bit Server VM (23.7-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libglib-2.0.so.0+0x389c0] g_str_hash+0x0


The other issue addressed in the LP bug is the SmartSVN issue discussed here.

This issue in LP can be found here https://bugs.launchpad.net/ubuntu/+source/java-common/+bug/1241101 .
Comment 17 Quinn Balazs CLA 2013-10-22 16:33:18 EDT
In the previous comment I attached a different portion of the log file than I had intended to. Here is the relevant portion.

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.gtk.OS._gtk_widget_show(J)V+0
j  org.eclipse.swt.internal.gtk.OS.gtk_widget_show(J)V+8
j  org.eclipse.swt.widgets.MenuItem.createHandle(I)V+249
j  org.eclipse.swt.widgets.Widget.createWidget(I)V+2
j  org.eclipse.swt.widgets.MenuItem.<init>(Lorg/eclipse/swt/widgets/Menu;I)V+19
Comment 18 Thomas Pasch CLA 2013-11-14 04:58:57 EST
*** Bug 420499 has been marked as a duplicate of this bug. ***
Comment 19 Joe Bublor CLA 2013-11-22 14:16:07 EST
I am using Open Suse 13.1 and I can reproduce this every time.  I did not see this until I installed 13.1 from a fresh install, then install the ADT bundle from Android developer site. 

Per instructions found on the Ubuntu site, I can change the GTK2 theme from oxygen to Raleigh and the crash goes away.
Comment 20 Alexander Kurtakov CLA 2013-12-06 05:28:56 EST
(In reply to Joe Bublor from comment #19)
> I am using Open Suse 13.1 and I can reproduce this every time.  I did not
> see this until I installed 13.1 from a fresh install, then install the ADT
> bundle from Android developer site. 
> 
> Per instructions found on the Ubuntu site, I can change the GTK2 theme from
> oxygen to Raleigh and the crash goes away.

Joe, I would dare to say it's a bug in oxygen theme. We had few such on Fedora too especially with oxygeng-gtk2 theme.
Comment 21 David CLA 2014-02-11 10:40:27 EST
Same issue in Ubuntu 14.04 (Unity). 
Tested with eclipse 3.8.2 and 4.3.1 with oracle-java7 and openjdk-7.
After install and first time start, eclipse freeze and crash, second start works fine, but when download a project from git, or download a maven project or starting tomcat, eclipse crash.
Comment 22 David Matějček CLA 2014-04-10 04:17:21 EDT
Reproduced also with the JDK6, OpenJDK7, and finally JDK8:
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Problematic frames occurs in two variants:
1) # C  [libgobject-2.0.so.0+0x31b3c]  g_type_check_instance_is_a+0x3c
2) # C  [libgtk-x11-2.0.so.0+0x24492a]  gtk_widget_queue_draw+0x1a

The Eclipse crashes sometimes after 5 minutes after start, sometimes after 6 hours, sometimes hangs and crashes after few seconds or even ten minutes. Always with one of these variants.
Comment 23 David Matějček CLA 2014-04-10 21:23:11 EDT
Workaround: 
1) Start the Eclipse
2) find pid of the process
3) taskset -p 0x00000001 <pid>

The problem is something like with volatile and synchronized; with this I used two Eclipse instances for 12 hours without a crash!
After restart I forgot to set it again and Eclipse crashed after 5 minutes ...

Now again with taskset after 2 hours no problem.
Comment 24 David Matějček CLA 2014-04-15 06:50:29 EDT
EDIT: workaround does not help. And one more note: Eclipse crashes earlier when showing variables in debug mode.
Comment 25 David Matějček CLA 2014-04-16 07:49:38 EDT
It seems it is fixed in newer GTK, but after my recent experiences I am not so optimistic. But after upgrade to 1.3.5 and also GTK 3.10 and restarting the system Eclipse still did not crash (10 hours yesterday, 5 hours today, switching git branches on massive project, debugging, refactoring).

Can you try it someone too? (package is big, you need fast connection)
sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt-get install libgtk-3-0
Download 1.3.5: https://launchpad.net/ubuntu/+source/oxygen-gtk3
Unpack and see instructions in the file INSTALL.

I hope Eclipse will be stable on Kubuntu 14.04 without these experiments ...
Comment 26 hkais CLA 2014-05-15 14:39:46 EDT
same issue here with ubuntu 13.10 x64
Comment 27 Fabien Toral CLA 2014-06-06 11:39:05 EDT
Created attachment 244042 [details]
crash log

(In reply to David Matějček from comment #22)
> Problematic frames occurs in two variants:
> 1) # C  [libgobject-2.0.so.0+0x31b3c]  g_type_check_instance_is_a+0x3c
> 2) # C  [libgtk-x11-2.0.so.0+0x24492a]  gtk_widget_queue_draw+0x1a
> 

I've a third variant in the crash log provided in attachment :
# C  [libgdk-x11-2.0.so.0+0x5173f]  gdk_display_open+0x3f

The crash occurs directly at startup while the splash screen is displayed.

My system is a fresh Debian Wheezy 7.5, the gtk version found is :
libgtk-3-common                       3.4.2-7

I'll try to find some time to check with a newer GTK as suggested by your comment #25
Comment 28 fnfhspwanv fnfhspwanv CLA 2014-06-15 22:16:54 EDT
Can confirm the issue with:
- Kubuntu 14.04 amd64
- Eclipse 3.8.1
- java -version = java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7, (7u55-2.4.7-1ubuntu1), OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

Tried the following workarounds, all did not help
- Opening the search menu (CTRL+F) and closing it with ESC only takes 2-3 attempts to crash Eclipse:

- Setting affinity (taskset -c 1 eclipse)
- Setting theme to Raleigh in systemsettings
- GTK2_RC_FILES=/usr/share/themes/Raleigh/gtk-2.0/gtkrc eclipse
- UBUNTU_MENUPROXY= eclipse
- Using all of the above at once ("export GTK2_RC_FILES=/usr/share/themes/Raleigh/gtk-2.0/gtkrc ; export UBUNTU_MENUPROXY= ; taskset -c 1 eclipse" - and setting Raleigh in systemsettings)


Typical hs_err file:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f487db99718, pid=13246, tid=139949693536000
#
# JRE version: OpenJDK Runtime Environment (7.0_55-b14) (build 1.7.0_55-b14)
# Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libgobject-2.0.so.0+0x19718] g_object_get_qdata+0x18
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Comment 29 Fabien Toral CLA 2014-06-23 09:10:05 EDT
So, after few tries in Virtual Machines to test different Debian/gtk versions, and other researches on the net, I found a workaround to make Luna work on my Debian laptop :

export SWT_GTK3=0

That aims to fallback to the GTK2 SWT implementation and bring my Eclipse back!

I was not on the right bug report, and found my way with a comment on bug #430736 https://bugs.eclipse.org/bugs/show_bug.cgi?id=430736#c26

With that, it comes to me that the only solution, as i don't want to upgrade my glibc, is to fallback to GTK2...

And thanks to http://www.eclipse.org/swt/R4_4/new_and_noteworthy.html#m3, the information was there...
Comment 30 Robert Muil CLA 2014-08-11 06:29:58 EDT
I'm also seeing instability with SIGSEVs in the native code when running eclipse.
I tried the SWT_GTK3=0 workaround, but got the following crash:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5f9d789d6c, pid=7849, tid=140048942749440
#
# JRE version: Java(TM) SE Runtime Environment (7.0_60-b19) (build 1.7.0_60-b19)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.60-b09 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgobject-2.0.so.0+0x31d6c]  g_type_check_instance_is_a+0x3c
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/rmuil/hs_err_pid7849.log
Compiled method (nm)   87459 1185     n       org.eclipse.swt.internal.gtk.OS::_g_object_get_qdata (native)
 total in heap  [0x00007f5fa517f290,0x00007f5fa517f610] = 896
 relocation     [0x00007f5fa517f3b0,0x00007f5fa517f410] = 96
 main code      [0x00007f5fa517f420,0x00007f5fa517f610] = 496
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Comment 31 Kamil Khamitov CLA 2014-08-18 14:10:52 EDT
Created attachment 246108 [details]
full log

Hello, with Eclipse 4.2.2 with ADT get this bug.  
Core dump https://yadi.sk/d/UTGqkxJmZz6e7

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fe3b0b716b8, pid=6629, tid=140615974131456
#
# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgobject-2.0.so.0+0x1a6b8]  g_object_get_qdata+0x18
#
# Core dump written. Default location: /home/lberserq/java/adt-bundle-linux-x86_64-20140702/eclipse/core or core.6629
#
# An error report file with more information is saved as:
# /home/lberserq/java/adt-bundle-linux-x86_64-20140702/eclipse/hs_err_pid6629.log
Compiled method (nm)  139197  719     n       org.eclipse.swt.internal.gtk.OS::_g_object_get_qdata (native)
 total in heap  [0x00007fe3a9103390,0x00007fe3a9103710] = 896
 relocation     [0x00007fe3a91034b0,0x00007fe3a9103510] = 96
 main code      [0x00007fe3a9103520,0x00007fe3a9103710] = 496
Comment 32 Arun Thondapu CLA 2014-08-25 13:36:37 EDT
(In reply to Kamil Khamitov from comment #31)
> Created attachment 246108 [details]
> full log
> 
> Hello, with Eclipse 4.2.2 with ADT get this bug.  
> Core dump https://yadi.sk/d/UTGqkxJmZz6e7
> 
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  SIGSEGV (0xb) at pc=0x00007fe3b0b716b8, pid=6629, tid=140615974131456
> #
> # JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build
> 1.7.0_67-b01)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode
> linux-amd64 compressed oops)
> # Problematic frame:
> # C  [libgobject-2.0.so.0+0x1a6b8]  g_object_get_qdata+0x18

This crash is bug 372560 which is fixed since Eclipse 4.3.
Comment 33 Tom Deering CLA 2014-10-13 06:11:48 EDT
Created attachment 247831 [details]
Additional crash log

Eclipse 4.3.2 crashes *constantly* (several times per day) with this problem on Ubuntu 14.04. The UI goes grey and unresponsive, and after force-quitting the application I get an error log with a stack trace about a seg fault in native code invoked from org.eclipse.swt.internal.gtk.OS._gtk_widget_show().

I've heard rumors that GTK on Ubuntu is not entirely sound. Eclipse may actually be a victim here rather than the culprit.
Comment 34 JP T CLA 2014-12-27 10:58:35 EST
Hi, 

I simply don't understand why nobody fixes this bug. 
This was already discussed a thousand times.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=430736

The problem occurs in any eclipse versions I tried (beginning with eclipse-3.8 from Ubuntu repo). 

workarounds are either: 

export SWT_GTK3=0

for me also worked
export SWT_GTK3=1

the other bug says put into eclipse.ini:
--launcher.GTK_version
2

If you don't fix it, why don't you deliver any of the workarounds?
Comment 35 U Klein CLA 2015-02-03 10:07:37 EST
same problem for an old Eclipse 3.6.2. the workaround worked for me: http://askubuntu.com/a/530468
Comment 36 Levente Farkas CLA 2015-03-05 06:52:10 EST
it's still happened on rhel/centos-7.0 with:
- eclipse-swt-4.4.0
- glib2-2.36.3
is there any solution to this?
Comment 37 Marc-André Laperle CLA 2015-05-01 17:56:04 EDT
I can reproduce the crash using Thomas Singer's example code (comment 9), on Ubuntu 13.10 and 14.04 when UBUNTU_MENUPROXY is enabled. If I disable UBUNTU_MENUPROXY it works. I think it's the same issue as bug 461311: radio button in the menu. Can we mark one as duplicate of the other?
Comment 38 Arun Thondapu CLA 2015-05-04 13:19:09 EDT
*** Bug 466326 has been marked as a duplicate of this bug. ***
Comment 39 Simone Perriello CLA 2015-05-11 10:39:04 EDT
For me, no one of the suggested workarounds work. I tried with export SWT_GTK3=0 or export SWT_GTK3=1, but every time I move the mouse pointer on Project>Build Working Set Eclipse crashes with the following 
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fa334a1efe0, pid=30089, tid=140339583497984
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libglib-2.0.so.0+0x38fe0]  g_str_hash+0x0
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

(Note that it always names g_str_hash+0x0).
If you like, I can attach the full log file.
Comment 40 Marc-André Laperle CLA 2015-05-12 14:11:43 EDT
(In reply to Simone Perriello from comment #39)
> For me, no one of the suggested workarounds work. I tried with export
> SWT_GTK3=0 or export SWT_GTK3=1, but every time I move the mouse pointer on
> Project>Build Working Set Eclipse crashes with the following 

Have you tried UBUNTU_MENUPROXY=0 ?
Comment 41 Simone Perriello CLA 2015-05-12 17:27:41 EDT
(In reply to Marc-Andre Laperle from comment #40)
> (In reply to Simone Perriello from comment #39)
> > For me, no one of the suggested workarounds work. I tried with export
> > SWT_GTK3=0 or export SWT_GTK3=1, but every time I move the mouse pointer on
> > Project>Build Working Set Eclipse crashes with the following 
> 
> Have you tried UBUNTU_MENUPROXY=0 ?

Tried, and it always crash every single time.
Comment 42 Cristiano Gaviao CLA 2015-05-12 17:49:57 EDT
(In reply to Simone Perriello from comment #41)
> Tried, and it always crash every single time.

Have you tried this? to create a desktop configuration file and set its command as:

env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0 /thepathToEclipse/eclipse

I've being using this for months with many ubuntu machines and is working great.
Comment 43 Simone Perriello CLA 2015-05-13 07:50:01 EDT
(In reply to Cristiano Gaviao from comment #42)
> (In reply to Simone Perriello from comment #41)
> > Tried, and it always crash every single time.
> 
> Have you tried this? to create a desktop configuration file and set its
> command as:
> 
> env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0 /thepathToEclipse/eclipse
> 
> I've being using this for months with many ubuntu machines and is working
> great.

Do you mean creating a .desktop file? If so, where I have to put the commands in the exec, right? Can you provide a template of a .desktop file? I've always launched Eclipse from terminal.
Comment 44 Simone Perriello CLA 2015-05-13 08:20:43 EDT
(In reply to Cristiano Gaviao from comment #42)
> (In reply to Simone Perriello from comment #41)
> > Tried, and it always crash every single time.
> 
> Have you tried this? to create a desktop configuration file and set its
> command as:
> 
> env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0 /thepathToEclipse/eclipse
> 
> I've being using this for months with many ubuntu machines and is working
> great.

It doesn't work anyway.
I've used this .desktop file

[Desktop Entry]
Version=4.4.2
Name=Eclipse-jee
GenericName=IDE
Comment=Programming IDE
MimeType=
Exec=env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0 /opt/eclipse_all/eclipse-jee/eclipse
TryExec=eclipse-jee
Icon=/opt/eclipse_all/eclipse-jee/icon.xpm
Type=Application
Terminal=false
Categories=IDE;Development;

Eclipsee starts well, but crashes every time I try to move the pointer on Project->Build Working Set. It also crashes other times, but I haven't identified a pattern yet.
Comment 45 Cristiano Gaviao CLA 2015-05-13 08:28:02 EDT
(In reply to Simone Perriello from comment #43)
> Do you mean creating a .desktop file? If so, where I have to put the
> commands in the exec, right? Can you provide a template of a .desktop file?
> I've always launched Eclipse from terminal.

Yep, its a .desktop file that I've put in /usr/share/applications.

[Desktop Entry]
Version=4.5
Comment=Integrated Development Environment
Exec=env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0  /opt/eclipse-ide/java-mars/eclipse/eclipse
Type=Application
Icon=eclipse-luna.xpm
Terminal=false
NoDisplay=false
Categories=Development;IDE;Java
StartupWMClass=Eclipse
Name[en_US]=Eclipse Mars Java
Comment 46 Simone Perriello CLA 2015-05-14 05:22:47 EDT
(In reply to Cristiano Gaviao from comment #45)
> (In reply to Simone Perriello from comment #43)
> > Do you mean creating a .desktop file? If so, where I have to put the
> > commands in the exec, right? Can you provide a template of a .desktop file?
> > I've always launched Eclipse from terminal.
> 
> Yep, its a .desktop file that I've put in /usr/share/applications.
> 
> [Desktop Entry]
> Version=4.5
> Comment=Integrated Development Environment
> Exec=env LIBOVERLAY_SCROLLBAR=0 SWT_GTK3=0 
> /opt/eclipse-ide/java-mars/eclipse/eclipse
> Type=Application
> Icon=eclipse-luna.xpm
> Terminal=false
> NoDisplay=false
> Categories=Development;IDE;Java
> StartupWMClass=Eclipse
> Name[en_US]=Eclipse Mars Java

More or less, it's the same .desktop file that I've used (see my comment above). However, as said, it doesn't work at all.
Comment 47 Simone Perriello CLA 2015-05-15 16:36:16 EDT
Don't know if it can be useful, but often after the crash the bash shell from which I've launched Eclipse doesn't respond to keyboard commands.
Comment 48 Stefan Xenos CLA 2015-05-27 13:13:59 EDT
Created attachment 253846 [details]
Short SWT snippet that reproduces the problem
Comment 49 Thomas Singer CLA 2015-06-24 13:59:11 EDT
Created attachment 254676 [details]
crash log
Comment 50 Stefan Xenos CLA 2015-08-12 14:08:18 EDT
Note that there was some further discussion of this bug here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=461311

In addition to causing crashes when opening the Window menu, it also can cause "reset perspective" to crash.

This only occurs under Ubuntu, and seems related to Ubuntu's menuproxy feature (the thing where it moves the menus to the top of the screen).

In case anyone missed it, I've attached an SWT-only code snippet that demonstrates the crash in about a page of code.
Comment 51 Stefan Xenos CLA 2015-08-12 15:06:05 EDT
You can also reproduce this in Eclipse by clicking Run... > Breakpoint Types
Comment 52 Thomas Singer CLA 2015-08-26 06:03:19 EDT
A user reported this problem for the latest SmartGit, too, though we already set a couple of environment variables in the launcher script to prevent it. He runs Linux Mint 17.2 Cinnamon and had the "Global Application Menu" applet installed. After disabling that, SmartGit did not crash any more.
Comment 53 Taehoon Kwak CLA 2015-09-04 09:33:22 EDT
Created attachment 256390 [details]
Patch

Hi. I have looked into this problem and came up with the following workaround patch that still uses Unity and avoids the crash.

I found that the crash occurs because a new Radio menu is created with *empty label*
for which unity_gtk_action_group_get_state_name() returns null and this ends up with a null-pointer dereference at g_str_hash().

My suggestion is to modify _1gtk_1radio_1menu_1item_1new_1with_1label() in os.c to call gtk_radio_menu_item_new_with_label() with an arbitrary, non-empty string if the
given string for label is for empty string (2nd parameter). In this patch, I used the string with one space (" ") as an arbitrary text.

I confirmed that, with this patch, the test given by Thomas Singer passes and all tests in Test_org_eclipse_swt_widgets_MenuItem.java pass as well. 
Please let me know if you have any question or suggestion for this patch. Thanks.


--- "a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c" 2013-05-14 11:50:23.000000000 +0900
+++ "b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c" 2015-09-04 19:49:40.768009600 +0900
@@ -13868,7 +13868,10 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1radio_1menu_1item_1new_1with_1label)
    jintLong rc = 0;
    OS_NATIVE_ENTER(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);
    if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
-   rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, (const gchar *)lparg1);
+   if (lparg1[0] == '\0')
+       rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, (const gchar *)" ");
+   else
+       rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, (const gchar *)lparg1);
 fail:
    if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
    OS_NATIVE_EXIT(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);
Comment 54 Marc-André Laperle CLA 2015-09-04 10:34:32 EDT
(In reply to Taehoon Kwak from comment #53)
> I found that the crash occurs because a new Radio menu is created with
> *empty label*
> for which unity_gtk_action_group_get_state_name() returns null and this ends
> up with a null-pointer dereference at g_str_hash().

Would it be a good idea to fix unity_gtk_action_group_get_state_name to that it returns an empty string instead of null? I'm thinking it would be good to fix the root cause for other programs and earlier versions of Eclipse.
Comment 55 Taehoon Kwak CLA 2015-09-05 00:45:13 EDT
(In reply to Marc-Andre Laperle from comment #54)
> (In reply to Taehoon Kwak from comment #53)
> > I found that the crash occurs because a new Radio menu is created with
> > *empty label*
> > for which unity_gtk_action_group_get_state_name() returns null and this ends
> > up with a null-pointer dereference at g_str_hash().
> 
> Would it be a good idea to fix unity_gtk_action_group_get_state_name to that
> it returns an empty string instead of null? I'm thinking it would be good to
> fix the root cause for other programs and earlier versions of Eclipse.

My patch is a workaround that changes uses of Unity. Patching Unity seems a nice idea, yet I am not sure of any side effect
Comment 56 Martin Oberhuber CLA 2015-10-01 04:59:43 EDT
Many thanks for the analysis so far, the explanation with "empty radio label" makes a lot of sense! - Does anyone know if a ticket already exists with Ubuntu for getting this fixed ?

We also do see the crash occasionally with Mars on Ubuntu 14.04 64-bit.
The suggested workarounds SWT_GTK3=0 UBUNTU_MENUPROXY=0 have been applied.
A fix in either Mars.2 or an Ubuntu 14.04 update would be highly appreciated !

CQ:WIND00-WB4-6132
Comment 57 Marc-André Laperle CLA 2015-10-16 14:13:37 EDT
*** Bug 449031 has been marked as a duplicate of this bug. ***
Comment 58 Marc-André Laperle CLA 2016-03-08 01:33:50 EST
I'll assign to myself for now to investigate a fix in Ubuntu. Otherwise we can try to apply the patch in SWT.
Comment 59 Marc-André Laperle CLA 2016-03-08 12:06:48 EST
The issue is fixed in Ubuntu >= 14.10. I proposed a patch to back-port the fix to 14.04, see https://bugs.launchpad.net/ubuntu/+source/unity-gtk-module/+bug/1427866/comments/5
Comment 60 Kalyan Prasad Tatavarthi CLA 2016-04-04 02:17:06 EDT
*** Bug 457512 has been marked as a duplicate of this bug. ***
Comment 61 Markus Keller CLA 2016-04-05 11:03:31 EDT
*** Bug 462002 has been marked as a duplicate of this bug. ***
Comment 62 Markus Keller CLA 2016-04-05 12:40:54 EDT
There's no point in delaying a workaround in SWT for this crash. Attachment 253846 [details] still reproduces on Ubuntu 14.04.

AFAICS, this is the place where the fix in Ubuntu could eventually show up:
http://bazaar.launchpad.net/~indicator-applet-developers/unity-gtk-module/trunk.14.04/view/head:/lib/unity-gtk-action-group.c#L848

Released a simple workaround to master: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=534ed490b51e7b64f0afdbd1595dc7098177d066
Comment 63 Markus Keller CLA 2016-04-05 13:06:02 EDT
*** Bug 465485 has been marked as a duplicate of this bug. ***
Comment 64 Marc-André Laperle CLA 2016-04-05 14:15:46 EDT
Thanks Markus!