ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.18k stars 173 forks source link

D-BUS Double Unref - Fatal With Vanilla D-BUS #4464

Open ikeydoherty opened 8 years ago

ikeydoherty commented 8 years ago

The Steam client currently segfaults on non-Debian systems due to a double-unref by the Steam client. This doesn't appear in Debian and Ubuntu because a patch is carried to forcibly disable fatal warnings in dbus, allowing bad API usage.

Note that this particular bug is common, and a a constant source of coredump uploads upon exit of Steam, which unrefs a closed connection:

#0  0xf7784bb2 in  () at /lib/ld-linux.so.2
#1  0xf7278509 in raise () at /usr/lib32/libc.so.6
#2  0xf7279bf7 in abort () at /usr/lib32/libc.so.6
#3  0xf1ed11a7 in  () at /usr/lib32/libdbus-1.so.3
#4  0xf1ec6734 in  () at /usr/lib32/libdbus-1.so.3
#5  0xf1eaa929 in dbus_connection_unref () at /usr/lib32/libdbus-1.so.3
#6  0xf03158be in dbus_g_connection_unref () at /usr/lib32/libdbus-glib-1.so.2
#7  0xef557a74 in  ()
    at /home/ikey/.local/share/Steam/ubuntu12_32/steamclient.so
#8  0xef5a5973 in  ()
    at /home/ikey/.local/share/Steam/ubuntu12_32/steamclient.so
#9  0xef59aa66 in  ()
    at /home/ikey/.local/share/Steam/ubuntu12_32/steamclient.so
#10 0xef58b035 in  ()
    at /home/ikey/.local/share/Steam/ubuntu12_32/steamclient.so
#11 0xf3e4665a in  () at /home/ikey/.local/share/Steam/ubuntu12_32/steamui.so
#12 0xf42e26e0 in  () at /home/ikey/.local/share/Steam/ubuntu12_32/steamui.so
#13 0xf42e91fa in  () at /home/ikey/.local/share/Steam/ubuntu12_32/steamui.so
#14 0x56628d4a in RunSteam(int, char**, bool) ()
#15 0x566118f2 in  ()
#16 0xf7262715 in __libc_start_main () at /usr/lib32/libc.so.6
#17 0x56614009 in _start ()

Now, I know correcting the issue in Steam is probably going to take a bit of fixing, so there is a valid workaround you can implement in the main $bindir/steam script:

export DBUS_FATAL_WARNINGS=0

This is currently being used in LSI to prevent mass coredumps reaching Valve, though obviously the actual underlying bug should still be fixed.

LSI fix: https://github.com/solus-project/linux-steam-integration/commit/82512dece012448ad3ab4eea586ee6d2d7900cdd

Steps for reproducing this issue:

  1. Run Steam on any non-Debian distro
  2. Start up Steam, close from menu
  3. Observe curl upload of dump due to double dbus unref

If you have cannot immediately reproduce this, disabling the STEAM_RUNTIME will force it to happen. (STEAM_RUNTIME=0)

Related patched library in Steam runtime: http://archive.ubuntu.com/ubuntu/pool/main/d/dbus/dbus_1.4.18-1ubuntu1.7.debian.tar.gz

Mirrored patch used in Ubuntu package: https://git.solus-project.com/packages/dbus/tree/files/no-fatal-warnings.patch

Note that the patch causes non-standard behaviour so shouldn't be relied upon, i.e. this is not the upstream dbus default behaviour. For now the export trick will be the best approach until a full solution has been found.

To debug in your dev-sdk builds, ensure you set:

export DBUS_FATAL_WARNINGS=1

To override the behaviour of the Ubuntu patch.

anthraxx commented 7 years ago

I can confirm this issue in all its details. Stumbled over this ticket while investigating some steam shutdown related coredumps that contained dbus_g_connection_unref (libdbus-glib-1.so.2). Using the workaround DBUS_FATAL_WARNINGS=0 does its job, steam exits cleanly.