gnome-shell gdb instructions cause immediate "Oh no" crash
This was originally reported in Ubuntu 21.04 at https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1937958 . Please see that for fuller context.
Affected version
Ubuntu 21.04 (amd64)
gnome-shell version 3.38.4
Using Xorg (haven't tried Wayland)
Bug summary
Running gnome-shell --replace
under gdb from an ssh shell or another vt, as described at
https://wiki.gnome.org/Projects/GnomeShell/Debugging
results in an immediate crash. A white screen appears with
Oh No... something went wrong...
and no recovery is possible (except to log out).
Note: The wiki incorrectly assumes only one process exists with "gnome-shell" in its name, and so the proffered gnome_session=$(pgrep -u $USER gnome-session)
sets that variable to multiple PIDs with subsequent mis-behavior. My fix for that is to use gnome_session=$(pgrep -u $USER gnome-session|head -1)
instead, with the remaining setup essentially as shown in the wiki.
But I might have messed this up, so that the environment variables are still not correct for the replacement gnome-shell to work correctly (see script below).
Steps to reproduce
- Log into an xorg session (I used autologin-after-reboot but don't know if that matters)
- In another VT, or in a ssh terminal session from another machine, run this:
#!/bin/sh
# See https://wiki.gnome.org/Projects/GnomeShell/Debugging
set -u -e
#gnome_session=$(pgrep -u $USER gnome-session)
gnome_session=$(pgrep -u $USER gnome-session|head -1)
eval export $(sed 's/\o000/\n/g;' < /proc/$gnome_session/environ | grep DISPLAY)
eval export $(sed 's/\o000/\n/g;' < /proc/$gnome_session/environ | grep XAUTHORI
TY)
eval export $(sed 's/\o000/\n/g;' < /proc/$gnome_session/environ | grep DBUS_SES
SION_BUS_ADDRESS)
rm -f gslog.log
cat <<'EOF'
At gdb prompt:
(gdb) run
# When crash occurs:
(gdb) t a a bt
...
(gdb) call (void)gjs_dumpstack ()
(gdb) quit
EOF
set -x
env | egrep 'DISPLAY|XAUTH|DBUS_SESSION'
gdb --args /usr/bin/gnome-shell --replace
What happened
Immediately after I entered the run
command to gdb, many messages appeared on the terminal including this:
(gnome-shell:4272): Gjs-CRITICAL **: 09:34:17.794: Object Gio.DBusProxy
(0x555557d0fa70), has been already deallocated — impossible to access it.
This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
The white "Oh No..." screen also appeared in the Xorg session.
I typed Control-C to gdb and produced backtraces but they don't look useful (see attached typescript file).
Nothing was left in /var/crash
I will attach /var/syslog in case that is useful.
What did you expect to happen
I wanted gnome-shell to run normally but under gdb, so that I could get a backtrace from another problem (mentioned in the referenced ubuntu bug)