Ubuntu Budgie - panel crashed with SIGSEGV in g_slice_alloc()

Bug #1631745 reported by Rob Peters
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
budgie-desktop
Fix Released
Unknown
budgie-desktop (Ubuntu)
Fix Released
Medium
fossfreedom
gnome-menus (Ubuntu)
Fix Released
High
fossfreedom

Bug Description

Testing in VirtualBox (xubuntu)
Clean install of Release Candidate, updated and reboot.
Opened terminal and installed synaptic
Wend to budgie menu and left frame frozen and then panel crash.

ProblemType: Crash
DistroRelease: Ubuntu 16.10
Package: budgie-core 10.2.7-2
ProcVersionSignature: Ubuntu 4.8.0-21.23-generic 4.8.0
Uname: Linux 4.8.0-21-generic x86_64
ApportVersion: 2.20.3-0ubuntu7
Architecture: amd64
CurrentDesktop: Budgie:GNOME
Date: Sun Oct 9 06:54:50 2016
ExecutablePath: /usr/bin/budgie-panel
InstallationDate: Installed on 2016-10-09 (0 days ago)
InstallationMedia: budgie-remix 16.10 "Budgie-remix" - amd64 (20161008)
ProcCmdline: hostname-panel
ProcEnviron:
 LANGUAGE=en_US
 PATH=(custom, user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SegvAnalysis:
 Segfault happened at: 0x7fe07a0ee45c <g_slice_alloc+412>: mov (%rdx),%rcx
 PC (0x7fe07a0ee45c) ok
 source "(%rdx)" (0xd000000000000000) not located in a known VMA region (needed readable region)!
 destination "%rcx" ok
SegvReason: reading unknown VMA
Signal: 11
SourcePackage: budgie-desktop
StacktraceTop:
 g_slice_alloc () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
 pango_layout_get_iter () from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
 pango_renderer_draw_layout () from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
 ?? () from /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
 gtk_render_layout () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
Title: hostname-panel crashed with SIGSEGV in g_slice_alloc()
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Revision history for this message
Rob Peters (makitso) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 g_slice_alloc () from /tmp/apport_sandbox_5GAZ6R/lib/x86_64-linux-gnu/libglib-2.0.so.0
 pango_layout_get_iter (layout=layout@entry=0x556552915430) at /build/pango1.0-fyOH9X/pango1.0-1.40.1/./pango/pango-layout.c:5758
 pango_renderer_draw_layout (renderer=renderer@entry=0x556552698410, layout=layout@entry=0x556552915430, x=x@entry=0, y=y@entry=0) at /build/pango1.0-fyOH9X/pango1.0-1.40.1/./pango/pango-renderer.c:182
 _pango_cairo_do_layout (cr=0x5565527bf800, layout=0x556552915430, do_path=0) at /build/pango1.0-fyOH9X/pango1.0-1.40.1/./pango/pangocairo-render.c:1020
 gtk_do_render_layout (layout=0x556552915430, y=0, x=0, cr=0x5565527bf800, context=0x5565526a3500) at ././gtk/gtkrender.c:526

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : StacktraceSource.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in budgie-desktop (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
Jeremy Bícha (jbicha)
information type: Private → Public
Revision history for this message
fossfreedom (fossfreedom) wrote : Re: hostname-panel crashed with SIGSEGV in g_slice_alloc()

This issue is in the same area as the linked issue. Problem is a known issue when installing new applications/removing applications

Fixed in the budgie-remix PPA - v10.2.8. I'll backport a patch that prevents the crash.

Changed in budgie-desktop (Ubuntu):
status: New → Confirmed
assignee: nobody → fossfreedom (fossfreedom)
Changed in budgie-desktop:
status: Unknown → New
Changed in budgie-desktop:
status: New → Fix Released
Revision history for this message
fossfreedom (fossfreedom) wrote :

Issue has been tracked down to Ubuntu patchwork of gnome-menus.

Building a vanilla Debian gnome-menus this issue does not occur.

Currently working on an update of one of Ubuntu's specific patches together with an additional patch that works around Ubuntu's other patches.

Changed in budgie-desktop (Ubuntu):
status: Confirmed → In Progress
Changed in gnome-menus (Ubuntu):
status: New → In Progress
assignee: nobody → fossfreedom (fossfreedom)
Revision history for this message
fossfreedom (fossfreedom) wrote :

This revised patch contained in the current zesty package switches the emphasis of the patch back to be a Unity specific (dash) issue as per the original LP for what it was created.

It does this by only running the delayed monitor sync part of the code if the desktop session itself is "ubuntu" i.e. for Unity.

For all other desktop-environments (in the context of this bug) - budgie-desktop, the original vanilla upstream code is executed.

For budgie-desktop this fixes various random segmentation and pointer issues that causes both a panel crash but more importantly whole X session crash.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "80_file_monitor_delayed.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
fossfreedom (fossfreedom) wrote :

This patch has been found to be required due to the inclusion of the other Ubuntu specific patches in gnome-menus.

Testing the vanilla orig tar file together with the Debian patchwork this patch has been found to NOT be required.

Testing the vanilla orig tar file together with the Debian patchwork + patch 80_*.patch - this patch is still required. Patch 80 fixes some of the observed panel crashes when uninstalling/installing applications. This patch fixes what appears to be remaining issues.

In terms of regression potential I would say zero regression potential. The code at this point is when desktop-entries are being released from memory i.e. memory cleanup. If Unity had ever hit this point because the desktop-entry was neither a directory or .desktop file then Unity would have automatically crashed. Since I haven't seen Unity crashes because of the forced assertion this code will never have been reached by Unity.

Revision history for this message
fossfreedom (fossfreedom) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work. There is no reason the monitor delay change should be specific to unity, the problem is real one and reported upstream on e.g https://bugzilla.gnome.org/show_bug.cgi?id=764277

The other patch should be reviewed, do you know why the monitor delay change leads to invalid desktop entries though?

Subscribing sponsors and Andrea who wrote the patch which is creating the issue

Changed in gnome-menus (Ubuntu):
importance: Undecided → High
Revision history for this message
fossfreedom (fossfreedom) wrote :

Thanks seb128 for the feedback.

The monitor delay change does not appear to cause the invalid desktop entries - that appears to be the rest of the Ubuntu specific patchwork.

Just to reiterate - taking the current Debian Stretch package and rebuilding for Zesty. Absolutely no issues and no need for additional patches.

With the current Ubuntu package. All current patches EXCEPT the monitor delay causes the invalid desktop entries.

With the current Ubuntu package including the existing monitor delay patch causes both invalid desktop entries + random crashes i.e. the random errors such as this bug report.

With the current Ubuntu package + our suggested 81-unref patch, we no longer see invalid desktop entries crashes but we occasionally see the random error crashes such as this bug report.

With the current Ubuntu package + our suggested 81-unref patch + our revised monitor changes patch we no longer see desktop entries crashes and we no longer see random error crashes.

These above are our observations - I don't particularly understand the patchwork ubuntu has - so I'm a bit reluctant to say categorically which of the other Ubuntu patches cause the invalid desktop entries crashes.

I've discussed with upstream and we've tried several rework attempts with the budgie-desktop code itself to no joy - so we have concluded (rightly or wrongly) its not budgie-desktop per-se that is the issue - it seems to be gnome-menus and ubuntu's version that is the issue.

---

FYI - for 17.04 Ubuntu Budgie is going to be using v10.2.9 of budgie-desktop and hence will be affected by the issues raised.

For 17.10 Ubuntu Budgie is going to be using either v11 of v12 of budgie-desktop - here upstream have completely rewritten this area and the code-base no longer uses gnome-menus and thus we no longer need the the suggested patches described here.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Would it be possible to have a valgrind log (https://wiki.ubuntu.com/Valgrind) of the issue? Or maybe a testcase that works under unity to trigger the issue? Our team is currently too busy to install another desktop and try to look at the issue but more details or a example we could easily play with could make it easier to work on...

Revision history for this message
fossfreedom (fossfreedom) wrote :

Sebastien - valgrind seems to hide the crash - i.e. running with valgrind I cannot make the panel crash.

The test case is very simple - Unity isnt affected by this.

#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 50 ]; do
  echo Loop $COUNTER
  let COUNTER=COUNTER+1
  sudo apt -y install mtpaint gimp simple-scan
  sudo apt -y remove mtpaint gimp simple-scan
done

I'm going to dig a bit further to see if I can narrow down which of the various combinations of ubuntu specific patches is causing this and if I can simplify the proposed patch in anyway.

Revision history for this message
fossfreedom (fossfreedom) wrote :

Please find enclosed a streamlined patch to resolve this issue for budgie-desktop.

I have ensured that the new code is only run for budgie-desktop.

This ensures that there is no regression potential.

summary: - hostname-panel crashed with SIGSEGV in g_slice_alloc()
+ Ubuntu Budgie - panel crashed with SIGSEGV in g_slice_alloc()
Revision history for this message
fossfreedom (fossfreedom) wrote :

as requested by seb I have attached a valgrind log

Revision history for this message
fossfreedom (fossfreedom) wrote :

AndyRock - not quite sure I understand the valgrind

in this bit of code:

tatic gboolean
monitor_callback_delayed (gpointer user_data)
{
  MonitorCallbackInfo *info;
  MenuMonitorEventInfo *event_info;
  MenuMonitorEvent event;
  MenuMonitor *menu_monitor;

  info = (MonitorCallbackInfo *) user_data;
  menu_monitor = info->menu_monitor;

  if (info->weak_ptr)
    {
      switch (info->eflags)
        {
        case G_FILE_MONITOR_EVENT_CHANGED:
          event = MENU_MONITOR_EVENT_CHANGED;
          break;
        case G_FILE_MONITOR_EVENT_CREATED:
          event = MENU_MONITOR_EVENT_CREATED;
          break;
        case G_FILE_MONITOR_EVENT_DELETED:
          event = MENU_MONITOR_EVENT_DELETED;
          break;
        default:
          event = MENU_MONITOR_EVENT_INVALID;
        }

      if (event != MENU_MONITOR_EVENT_INVALID)
        {
          event_info = g_new0 (MenuMonitorEventInfo, 1);

          event_info->path = g_file_get_path (info->child);
          event_info->event = event;
          event_info->monitor = menu_monitor;

          menu_monitor_queue_event (event_info);
        }

    }

  g_object_unref (info->child);
  g_free (info);
  return FALSE;
}

should the info->weak_ptr be removed immediately after menu_monitor_queue_event? maybe the g_free(info) is cleaning up the object first but info->weak_ptr is being cleaned up after the info object is removed.

Revision history for this message
fossfreedom (fossfreedom) wrote :
Revision history for this message
fossfreedom (fossfreedom) wrote :

Please find enc a patch that resolves this bug.

AndyRock via IRC #ubuntu-devel 10/02/17 suggested this fix. I have slightly altered this so that the the remove ptr line is within the weak-ptr if clause otherwise the weak-ptr function would crash where the ptr does not actually exist.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

Nish Aravamudan (nacc)
Changed in gnome-menus (Ubuntu):
status: In Progress → Fix Committed
Changed in budgie-desktop (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-menus - 3.13.3-6ubuntu5

---------------
gnome-menus (3.13.3-6ubuntu5) zesty; urgency=medium

  [ Andrea Azzarone ]
  * debian/patches/80_file_monitor_delated.patch:
    - update to existing path to remove weak pointer before menu-monitor
      memory deallocation; resolves budgie-desktop
      panel crash (LP: #1631745)

 -- Sebastien Bacher <email address hidden> Fri, 10 Feb 2017 20:15:18 +0000

Changed in gnome-menus (Ubuntu):
status: Fix Committed → Fix Released
Changed in budgie-desktop (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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