Java crash in libglib-2.0 after upgrade from 13.04 to 13.10

Bug #1241101 reported by Claude Durocher on 2013-10-17
518
This bug affects 127 people
Affects Status Importance Assigned to Milestone
Eclipse
Fix Released
Critical
gtk+2.0 (Suse)
New
Undecided
Unassigned
gtk+2.0 (Ubuntu)
High
Unassigned
unity (Ubuntu)
High
Unassigned

Bug Description

Running smartgit 4.6.4 on 13.10 64 bits. After registering the product, smartgit crash when trying to open a new repository. Java error log :

# 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

I tried different version of Java (Oracle v7 and v6 jre) with same result. Also, Eclipse display blank menus so there's a general java problem with displays.

Created attachment 236604
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

6 comments hidden view all 160 comments
Claude Durocher (claude-d) wrote :

I found a workaround : if I start smartgit like this, it won't crash :

UBUNTU_MENUPROXY= ./smartgit.sh

So the issue seem related to appmenu.

Quinn Balazs (qbalazs) wrote :

There should be a file containing the full context of the OpenJDK issue. All you added here is what the problematic frame, which is helpful in context, but not particularly on its own. See if you can't upload the error log, and once you have, set this back to new and someone will take a look.

Quinn Balazs

Changed in java-common (Ubuntu):
status: New → Incomplete
Claude Durocher (claude-d) wrote :
Download full text (114.2 KiB)

Here's the full log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007ff34dd759c0, pid=13319, tid=140683267766016
#
# 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
#
# 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:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-7/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

--------------- T H R E A D ---------------

Current thread (0x00007ff358009000): JavaThread "main" [_thread_in_native, id=13320, stack(0x00007ff360237000,0x00007ff360338000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000000

Registers:
RAX=0x00007ff358a9d230, RBX=0x00007ff358a9d230, RCX=0x0000000000000000, RDX=0x00007ff358a9d230
RSP=0x00007ff3603344a8, RBP=0x00007ff3590872a0, RSI=0x0000000000000000, RDI=0x0000000000000000
R8 =0x00007ff3590cc1a0, R9 =0x00007ff35825ed52, R10=0xaaaaaaaaaaaaaaab, R11=0x00007ff3585e1100
R12=0x00007ff358ad72a0, R13=0x00007ff358ad72a0, R14=0x0000000000000000, R15=0x0000000000000000
RIP=0x00007ff34dd759c0, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007ff3603344a8)
0x00007ff3603344a8: 00007ff34dd74b30 0000000000000000
0x00007ff3603344b8: 0000000000000000 00007ff358a9d230
0x00007ff3603344c8: 0000000058fc9890 0000000000000000
0x00007ff3603344d8: 00007ff358a9d230 00007ff358a6ff70
0x00007ff3603344e8: 00007ff358ad72a0 00007ff358ad72a0
0x00007ff3603344f8: 0000000000000000 0000000000000000
0x00007ff360334508: 00007ff3173bac62 00007ff358ef5870
0x00007ff360334518: 0000000000000012 00007ff358b31d10
0x00007ff360334528: 00007ff34dd9e8aa 00007ff3173b4c70
0x00007ff360334538: 00007ff35881c4c0 00007ff358a9d230
0x00007ff360334548: 00007ff358ef5870 0000000000000012
0x00007ff360334558: 00007ff358b31d10 00007ff358b100f0
0x00007ff360334568: 00007ff3173b53a2 0000000000000002
0x00007ff360334578: 0000000000000012 00007ff360334790
0x00007ff360334588: 00007ff34dd9ebb3 00007ff358a9d230
0x00007ff360334598: 00007ff34c8e8b00 00007ff358a9d230
0x00007ff3603345a8: 00007ff35881c4c0 0000000000000002
0x00007ff3603345b8: 00007ff3603347f0 00007ff360334790
0x00007ff3603345c8: 00007ff3173b6e46 00007ff358a9d230
0x00007ff3603345d8: 00007ff3173b8921 00007ff358a61a90
0x00007ff3603345e8: 00007ff358a61a90 00007ff3603347f0
0x00007ff3603345f8: 00007ff358570ac0 00007ff3603347f0
0x00007ff360334608: 00007ff359113b90 00007ff358a9d230
0x00007ff360334618: 00007ff3585a0890 00007ff3590f1d70
0x00007ff360334628: 00007ff34e050d50 0000000000000000
0x00007ff360334638: 00007ff359113b90 0000000000000002
0x00007ff360334648: 00007ff3603347f0 00007ff360334790
0x00007ff360334658: 00007ff34e04e188 0000000000000000
0x00007ff360334...

Changed in java-common (Ubuntu):
status: Incomplete → New
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in java-common (Ubuntu):
status: New → Confirmed
4 comments hidden view all 160 comments

The version.txt file inside the swt.jar shows "version 4.331".

Ubuntu 13.10

Is there any chance that you can give a snippet to reproduce the problem?

Created attachment 236645
crash log

Created attachment 236646
crash log

Created attachment 236647
crash log

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

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.

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.

Missed the createMenuItem method?

Sorry:

 private static MenuItem createMenuItem(int style, String text, Menu menu) {
  final MenuItem item = new MenuItem(menu, style);
  item.setText(text);
  return item;
 }

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?

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.

According to https://twitter.com/md__5/status/391352267313405952 the bug seems to be related to UBUNTU_MENUPROXY.

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.

17 comments hidden view all 160 comments
Dac Chartrand (conner-bw) wrote :

I have the same bug using SmartSVN (same vendor, historically at least), and their support narrowed it down to a problem with "Native crash in org.eclipse.swt.internal.gtk.OS._gtk_widget_show," see:

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

Dear: Java devs, please read thread above, Comment #15 in particular.

Cheers.

18 comments hidden view all 160 comments

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 .

17 comments hidden view all 160 comments
Quinn Balazs (qbalazs) wrote :

Tracking this issue in eclipse-bugs.

Quinn Balazs

18 comments hidden view all 160 comments

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

17 comments hidden view all 160 comments
Dac Chartrand (conner-bw) wrote :

Also see bug #1208019

Not a crash per say, but some coordinated effort to fix global menus that were working fine in 13.04. but must now be worked around setting UBUNTU_MENUPROXY would be prudent.

Best regards,

Changed in java-common (Ubuntu):
importance: Undecided → High
status: Confirmed → Triaged
Changed in java-common:
importance: Unknown → Critical
status: Unknown → Confirmed
18 comments hidden view all 160 comments
Quinn Balazs (qbalazs) wrote :

Posted here on behalf of Julien Aubin.

Quinn Balazs (qbalazs) wrote :

I have the same problem with Smartsvn.

Quinn Balazs (qbalazs) wrote :

Strangely, something that has worked for people in a few other situations has been to change GTK2 appearance to anything other than oxygen-gtk. If someone wouldn't mind checking that out, I'd be interested to see if that workaround works here, or if there are multiple issues at hand here.

Quinn Balazs (qbalazs) wrote :

I've taken a look at this, and seemingly randomly*, java frames flipflop between what we've seen here, and the

j org.eclipse.swt.internal.gtk.OS._g_object_get_qdata(JI)J+0
j org.eclipse.swt.internal.gtk.OS.g_object_get_qdata(JI)J+9
j org.eclipse.swt.widgets.Display.removeWidget(J)Lorg/eclipse/swt/widgets/Widget;+19
j org.eclipse.swt.widgets.Combo.deregister()V+21
j org.eclipse.swt.widgets.Widget.releaseWidget()V+1

that we've seen in bug #1205452. Changing GTK2 appearance will on occasion clear up the issue, but works nowhere near 100% of the time. Once I've done a bit more digging and am sure that these issues are at their roots the same, bug #1205452 can be marked as a duplicate of this issue, and maybe a bug pattern can be written for this issue (23 affected in #1205452, 16 affected here, and most people using Eclipse or a derived product will run into this issue)

*Nothing is random, I'm working on associating these differences to user actions.

Netziro (netziro) wrote :

Quinn, i've got the same scenario and changing GTK2 appearance did solve the issue. I had 2 machines affected and both solved changing the GTK2 opt

I change GTK apperance using gtk-theme-switch2 command, I can see the change on the othere applications (es. firefox) but smart svn crash with the same error.

Stack: [0x00007f275beb7000,0x00007f275bfb8000], sp=0x00007f275bfb3be8, free space=1010k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libglib-2.0.so.0+0x389c0] __float128+0x0

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

Netziro (netziro) wrote :

in my case that's the stack

Stack: [0x00007fa5c172b000,0x00007fa5c182c000], sp=0x00007fa5c18281f0, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libgobject-2.0.so.0+0x19528] g_object_get_qdata+0x18

[error occurred during error reporting (printing native stack), id 0xb]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J org.eclipse.swt.internal.gtk.OS._g_object_get_qdata(JI)J
J org.eclipse.swt.internal.gtk.OS.g_object_get_qdata(JI)J
j org.eclipse.swt.widgets.Display.removeWidget(J)Lorg/eclipse/swt/widgets/Widget;+19
j org.eclipse.swt.widgets.Combo.deregister()V+21
j org.eclipse.swt.widgets.Widget.releaseWidget()V+1
j org.eclipse.swt.widgets.Control.releaseWidget()V+1
j org.eclipse.swt.widgets.Composite.releaseWidget()V+1
j org.eclipse.swt.widgets.Combo.releaseWidget()V+1
j org.eclipse.swt.widgets.Widget.release(Z)V+82
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.TabFolder.releaseChildren(Z)V+54
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Composite.releaseChildren(Z)V+31
j org.eclipse.swt.widgets.Canvas.releaseChildren(Z)V+42
j org.eclipse.swt.widgets.Decorations.releaseChildren(Z)V+22
j org.eclipse.swt.widgets.Shell.releaseChildren(Z)V+100
j org.eclipse.swt.widgets.Widget.release(Z)V+38
j org.eclipse.swt.widgets.Control.release(Z)V+94
j org.eclipse.swt.widgets.Widget.dispose()V+23
j org.eclipse.swt.widgets.Shell.dispose()V+20
j org.eclipse.jface.window.Window.close()Z+65
j org.eclipse.jface.dialogs.Dialog.close()Z+26
j org.eclipse.search.internal.ui.SearchDialog.close()Z+40
j org.eclipse.search.internal.ui.util.ExtendedDialogWindow.buttonPressed(I)V+46
j org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Lorg/eclipse/swt/events/SelectionEvent;)V+17
j org.eclipse.swt.widgets.TypedListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V+1133
J org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V
j org.eclipse.swt.widgets.Widget.sendEvent(Lorg/eclipse/swt/widgets/Event;)V+25
j org.eclipse.swt.widgets.Display.runDeferredEvents()Z+92
j org.eclipse.swt.widgets.Display.readAndDispatch()Z+46
j org.eclipse.jface.window.Window.runEventLoop(Lorg/eclipse/swt/widgets/Shell;)V+23

spectator (lists-a) wrote :

FWIW, eclipse started crashing after upgrade to 13.10, always # Problematic frame: # C [libgobject-2.0.so.0+0x16bfe]
Upon reading #29 I changed GTK2 appearance a couple of times from oxygen-gtk to ambiance etc. For me this seems to touch the problem. Oxygen crashes, others do not. Reproducible.

sormariano (sormariano) wrote :

True, as the twitter says changing the .desktop file exec line to:

Exec=env UBUNTU_MENUPROXY=0 "[yoursmartgitbinpath]/smartgithg.sh" %u

Works, and runs with menues not integrated into unity panel.

Removing the two environment variables Smart Svn don't crash anymore.

GTK_IM_MODULE="ibus"
GTK_MODULES="overlay-scrollbar:unity-gtk-module"

For me that solved the problem.

It's sufficient remove only the variable
GTK_MODULES="overlay-scrollbar:unity-gtk-module"

Changed in gtk+2.0 (Ubuntu):
status: New → Triaged
importance: Undecided → High

*** Bug 420499 has been marked as a duplicate of this bug. ***

aanno (thomas-pasch) wrote :

As I already mentioned on #1245468 I could not verify that changing GTK_MODULES, UBUNTU_MENUPROXY, or GTK_IM_MODULE helps in any way.

However, I could verify that the problem GOES AWAYS IN KUBUNTU/KDE when doing:

System Settings -> Application Themes -> GTK -> Choose GTK2 Theme

Choose 'Radiance' instead of 'oxygen-gtk'

affects: gtk+2.0 (Ubuntu) → ubuntu
Quinn Balazs (qbalazs) on 2013-12-01
affects: ubuntu → gtk+2.0 (Ubuntu)
Quinn Balazs (qbalazs) on 2014-01-28
affects: java-common → eclipse
affects: java-common (Ubuntu) → unity (Ubuntu)
Changed in unity (Ubuntu):
status: Triaged → Invalid
Stephen M. Webb (bregma) on 2014-03-19
no longer affects: unity
80 comments hidden view all 160 comments

I can confirm this in Comsol Multiphysics, and various versions of eclipse and liclipse, on Kubuntu 14.04 64-bit. Really serious bug. The Eclipses tend to crash during debugging but it seems random. Comsol used to run for a while before crashing but now crashes as soon as you create a new blank model.

1 comments hidden view all 160 comments

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?

1 comments hidden view all 160 comments

*** Bug 466326 has been marked as a duplicate of this bug. ***

1 comments hidden view all 160 comments

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.

1 comments hidden view all 160 comments

(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 ?

1 comments hidden view all 160 comments

(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.

(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.

(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.

1 comments hidden view all 160 comments

(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.

(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

(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.

1 comments hidden view all 160 comments

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.

1 comments hidden view all 160 comments

Created attachment 253846
Short SWT snippet that reproduces the problem

1 comments hidden view all 160 comments

Created attachment 254676
crash log

1 comments hidden view all 160 comments

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.

You can also reproduce this in Eclipse by clicking Run... > Breakpoint Types

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.

Created attachment 256390
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);

(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.

(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

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

*** Bug 449031 has been marked as a duplicate of this bug. ***

I'll assign to myself for now to investigate a fix in Ubuntu. Otherwise we can try to apply the patch in SWT.

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

*** Bug 457512 has been marked as a duplicate of this bug. ***

*** Bug 462002 has been marked as a duplicate of this bug. ***

There's no point in delaying a workaround in SWT for this crash. Attachment 253846 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

Changed in eclipse:
status: Confirmed → Fix Released

*** Bug 465485 has been marked as a duplicate of this bug. ***

Displaying first 40 and last 40 comments. View all 160 comments or add a comment.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.