apport-gtk crashed with SIGSEGV in _gtk_settings_get_screen(settings=0x0) from gtk_css_value_icon_theme_compute() from gtk_css_static_style_compute_value()

Bug #1842439 reported by Xavier Guillot
150
This bug affects 17 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Invalid
High
Unassigned
Focal
Invalid
High
Unassigned
Lunar
Invalid
High
Unassigned
gtk+3.0 (Ubuntu)
Triaged
High
Unassigned
Focal
Triaged
High
Unassigned
Lunar
Won't Fix
High
Unassigned

Bug Description

Steps to reproduce
------------------

1. Use GNOME with GNOME shell
2. killall -11 gnome-shell

Suspicious Apport log:

gdbus call error: Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

Error tracker
-------------
https://errors.ubuntu.com/problem/815a179408135a894bbb5921adef3757563c75c5
https://errors.ubuntu.com/problem/276759c7bf0b6628977c63ca70d26b53c9defd22

Stack trace
-----------

Python:

```
  File "apport-gtk", line 703, in <module>
    app = GTKUserInterface(sys.argv)
  File "apport-gtk", line 68, in GTKUserInterface.__init__
        self.widgets.add_from_file(
            os.path.join(os.path.dirname(argv[0]), "apport-gtk.ui")
        )
```

StacktraceTop:
 _gtk_settings_get_screen (settings=0x0) at ../../../../gtk/gtksettings.c:3319
 gtk_css_value_icon_theme_compute (icon_theme=<optimized out>, property_id=<optimized out>, provider=<optimized out>, style=<optimized out>, parent_style=<optimized out>) at ../../../../gtk/gtkcssiconthemevalue.c:84
 gtk_css_static_style_compute_value (style=0x1e7c320, provider=0x0, parent_style=0x0, id=3, specified=0x7f53258b9b20 <inherit>, section=0x0) at ../../../../gtk/gtkcssstaticstyle.c:237
 _gtk_css_lookup_resolve (lookup=lookup@entry=0x1e7e790, provider=provider@entry=0x0, style=style@entry=0x1e7c320, parent_style=parent_style@entry=0x0) at ../../../../gtk/gtkcsslookup.c:122
 gtk_css_static_style_new_compute (provider=provider@entry=0x0, matcher=matcher@entry=0x0, parent=parent@entry=0x0) at ../../../../gtk/gtkcssstaticstyle.c:195

Original report
---------------
Session suddenly stopped and came back to login screen, all opened windows lost.

ProblemType: Crash
DistroRelease: Ubuntu 19.10
Package: apport-gtk 2.20.11-0ubuntu7
ProcVersionSignature: Ubuntu 5.2.0-15.16-generic 5.2.9
Uname: Linux 5.2.0-15-generic x86_64
ApportVersion: 2.20.11-0ubuntu7
Architecture: amd64
CrashReports:
 640:1000:117:7292709:2019-09-03 16:20:13.909392833 +0200:2019-09-03 16:20:14.909392833 +0200:/var/crash/_usr_share_apport_apport-gtk.1000.crash
 640:1000:117:48937942:2019-09-03 16:20:11.681426286 +0200:2019-09-03 16:20:12.681426286 +0200:/var/crash/_usr_bin_gnome-shell.1000.crash
 640:1000:117:32054:2019-08-27 17:39:07.125607490 +0200:2019-08-28 12:36:17.087672961 +0200:/var/crash/_usr_bin_dbus-daemon.1000.crash
CurrentDesktop: ubuntu:GNOME
Date: Tue Sep 3 16:20:13 2019
ExecutablePath: /usr/share/apport/apport-gtk
InstallationDate: Installed on 2018-06-16 (443 days ago)
InstallationMedia: Ubuntu 18.10 "Cosmic Cuttlefish" - Alpha amd64 (20180611)
InterpreterPath: /usr/bin/python3.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/share/apport/apport-gtk
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
Python3Details: /usr/bin/python3.7, Python 3.7.4, python3-minimal, 3.7.3-1
PythonDetails: /usr/bin/python2.7, Python 2.7.16+, python-minimal, 2.7.16-1
SegvAnalysis:
 Segfault happened at: 0x7f532548f8c4: mov 0x18(%rdi),%rax
 PC (0x7f532548f8c4) ok
 source "0x18(%rdi)" (0x00000018) not located in a known VMA region (needed readable region)!
 destination "%rax" ok
SegvReason: reading NULL VMA
Signal: 11
SourcePackage: apport
StacktraceTop:
 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
Title: apport-gtk crashed with SIGSEGV
UpgradeStatus: Upgraded to eoan on 2019-06-10 (84 days ago)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
separator:

Revision history for this message
Xavier Guillot (valeryan-24) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 _gtk_settings_get_screen (settings=0x0) at ../../../../gtk/gtksettings.c:3319
 gtk_css_value_icon_theme_compute (icon_theme=<optimized out>, property_id=<optimized out>, provider=<optimized out>, style=<optimized out>, parent_style=<optimized out>) at ../../../../gtk/gtkcssiconthemevalue.c:84
 gtk_css_static_style_compute_value (style=0x1e7c320, provider=0x0, parent_style=0x0, id=3, specified=0x7f53258b9b20 <inherit>, section=0x0) at ../../../../gtk/gtkcssstaticstyle.c:237
 _gtk_css_lookup_resolve (lookup=lookup@entry=0x1e7e790, provider=provider@entry=0x0, style=style@entry=0x1e7c320, parent_style=parent_style@entry=0x0) at ../../../../gtk/gtkcsslookup.c:122
 gtk_css_static_style_new_compute (provider=provider@entry=0x0, matcher=matcher@entry=0x0, parent=parent@entry=0x0) at ../../../../gtk/gtkcssstaticstyle.c:195

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 apport (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: apport-gtk crashed with SIGSEGV

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

Changed in apport (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: apport-gtk crashed with SIGSEGV in _gtk_settings_get_screen(settings=0x0)
summary: - apport-gtk crashed with SIGSEGV
+ apport-gtk crashed with SIGSEGV in
+ _gtk_settings_get_screen(settings=0x0)
information type: Private → Public
description: updated
tags: added: rls-ee-incoming
tags: added: focal
tags: removed: rls-ee-incoming
tags: added: id-5e4ecf76b760f78c1c9f34d6
tags: added: fr-232
Benjamin Drung (bdrung)
description: updated
tags: added: impish jammy kinetic
Changed in apport (Ubuntu):
status: Confirmed → Triaged
Changed in apport (Ubuntu Focal):
status: Confirmed → Triaged
description: updated
Revision history for this message
Benjamin Drung (bdrung) wrote :

Looking at the stack trace, there is pygi_callable_info_invoke (source: pygobject) -> pygi_invoke_c_callable (source: pygobject) -> gtk_builder_add_from_file (source: gtk+3.0) -> _gtk_settings_get_screen (source: gtk+3.0)

To fix this bug in apport, gtk_builder_add_from_file should raise an Exception. So I mark gtk+3.0 as affected.

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in gtk+3.0 (Ubuntu Focal):
status: New → Confirmed
Changed in gtk+3.0 (Ubuntu):
status: New → Confirmed
Benjamin Drung (bdrung)
Changed in apport (Ubuntu):
importance: Medium → High
Changed in apport (Ubuntu Focal):
importance: Medium → High
Revision history for this message
Benjamin Drung (bdrung) wrote :

More duplicate bug reports: bug #1988982 and bug #1989036.

tags: added: foundations-triage-discuss
tags: removed: foundations-triage-discuss
tags: added: rls-kk-incoming
Revision history for this message
Sebastien Bacher (seb128) wrote :
summary: apport-gtk crashed with SIGSEGV in
- _gtk_settings_get_screen(settings=0x0)
+ _gtk_settings_get_screen(settings=0x0) from
+ gtk_css_value_icon_theme_compute() from
+ gtk_css_static_style_compute_value()
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Investigated this, it is due to the theming code failing to get a settings object, probably due to the shell not running at the time. The GTK functions that return the settings object are allowed to return NULL, and this case was not being handled in GTK. The attached patch contains three fixes in GTK to handle these cases. These cases were found by forcing the settings object to be NULL and then running a test program and fixing the segfaults.

tags: added: patch
Revision history for this message
Benjamin Drung (bdrung) wrote :

Applied the patch to the package and re-run test case (killall -11 gnome-shell), but apport still crashed. See attached _usr_share_apport_apport-gtk.1000.crash.

Revision history for this message
Benjamin Drung (bdrung) wrote :

Print-line debugging shows that the Python code for that crash is in GTKUserInterface.__init__:

```
    self.widgets.add_from_file(
        os.path.join(os.path.dirname(argv[0]), "apport-gtk.ui")
    )
```

description: updated
Revision history for this message
Andrzej Doros (andrzejdoros) wrote :

Are there any updates on this issue?
My Ubuntu 22.04 is crashing on daily basis :-(

Revision history for this message
Brian Murray (brian-murray) wrote :

@bdrung - Speaking to the desktop team they indicated apport should catch the error and work around the issue given that a gtk fix isn't forthcoming.

Revision history for this message
Benjamin Drung (bdrung) wrote :

Sadly you cannot catch a C library segfault within Python code.

Steve Langasek (vorlon)
Changed in gtk+3.0 (Ubuntu):
status: Confirmed → Triaged
Changed in apport (Ubuntu):
status: Triaged → Invalid
Changed in apport (Ubuntu Focal):
status: Triaged → Invalid
Changed in gtk+3.0 (Ubuntu Focal):
status: Confirmed → Triaged
importance: Undecided → High
Changed in gtk+3.0 (Ubuntu):
importance: Undecided → High
tags: removed: rls-kk-incoming
Revision history for this message
Sebastien Bacher (seb128) wrote :

Clarifying from a Desktop perspective. Upstream isn't going to care about the issue because GTK3 isn't actively maintained at this point and it's not a 'real world issue' in the sense of it's an error that is hit when the session closes in an unprompted manner, which means no user would see a visible consequence if it wasn't the crash handler catching it.

It's a situation that should ideally be resolved and Robert tried to fix it but the patch needs more work and it's lower priority than other items so we didn't get to investigate more yet.

One other way would be to teach apport to ignore issues on session closing (which I think was done some years ago but maybe that isn't working anymore?)

Revision history for this message
Benjamin Drung (bdrung) wrote :

Apport is written in Python and uses try-except, but it does not catch segmentation faults.

Revision history for this message
Andrzej Doros (andrzejdoros) wrote :

Dear @Sebastien Bacher (seb128)

It isn't true that it isn't 'real world issue' (at least in my case). My Ubuntu 22.04 is randomly crashing (approximately once per day), all applications are closed and systems go to the login screen. During the crash time, I'm losing all my work, so it is seriously touching my daily tasks.
Due to the above, I will be appreciated, if someone will fix the bug.

Best regards,
Andrzej

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

@Andrzej, right, but the issue is that your session is closing and that's a probably in a key component as the shell, session manager and graphical server. Resolving the fact that 'ubuntu-bug', the bug report helper is being hit by the session closing would not solve your issue. You should for other .crash reports on your system and probably submit those

Revision history for this message
Benjamin Drung (bdrung) wrote :

The failure mode has changed a little bit in Ubuntu 23.10 (mantic): bug #2041518

Revision history for this message
Brian Murray (brian-murray) wrote :

Ubuntu 23.04 (Lunar Lobster) has reached end of life, so this bug will not be fixed for that specific release.

Changed in gtk+3.0 (Ubuntu Lunar):
status: Triaged → Won't Fix
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.