Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
gjs
gjs
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 98
    • Issues 98
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • gjsgjs
  • Issues
  • #115

Closed
Open
Opened Jan 31, 2018 by Jonas Ådahl@jadahlDeveloper

Failure in gjs_callback_closure() causes gnome-shell to incorrectly exit(1)

There is a bug, I'm thinking in GJS, causing gnome-shell to exit(EXIT_FAILURE) (thus without causing a core dump and probably invisible in distro crash logs). I can reproduce it by, from within gnome-shell do:

  1. Press Super+L (to lock)
  2. Hit Esc
  3. Goto 2

After a few times gnome-shell will exit without any trace of crash or suggestion where to start looking for what happened. After some suspicious log entries I thought it could be gdm related, but after some digging with @halfline we concluded that gnome-shell for some reason calls exit(1). I added a on_exit(if (exit_status == 1) abort()) in gnome-shell, which showed me that the exit(1) call was this one in gi/functions.cpp. It was invoked from a D-Bus message reply GTask.

After some digging, we end up there because of the gjs_value_from_g_argument() call under the PARAM_NORMAL case is failing for some reason. After that I enabled various gjs debug log stuff, which I'm attaching here: gjs.debuglog. I didn't investigate further than that.

A side note: wouldn't it make sense to change those exit(1)'s to g_error() to actually catch those errors?

Another side note: I used the following diff on mutter to catch the "crash":

diff --git a/src/core/main.c b/src/core/main.c
index dc1f1c4f6..19e74e790 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -494,6 +494,14 @@ meta_override_compositor_configuration (MetaCompositorType compositor_type,
   _backend_gtype_override = backend_gtype;
 }
 
+static void
+abort_on_exit_failure (int   retval,
+                       void *user_data)
+{
+  if (retval != 0)
+    g_error ("Something caused the program to exit with failure");
+}
+
 /**
  * meta_init: (skip)
  *
@@ -508,6 +516,8 @@ meta_init (void)
   MetaCompositorType compositor_type;
   GType backend_gtype;
 
+  on_exit (abort_on_exit_failure, NULL);
+
   sigemptyset (&empty_mask);
   act.sa_handler = SIG_IGN;
   act.sa_mask    = empty_mask;
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/gjs#115