After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754951 - gnome-session-3.16.0 crashed
gnome-session-3.16.0 crashed
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: general
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-13 11:17 UTC by Pacho Ramos
Modified: 2016-03-07 22:27 UTC
See Also:
GNOME target: 3.20
GNOME version: ---


Attachments
main: don't use g_setenv after start up (18.01 KB, patch)
2016-03-07 20:53 UTC, Ray Strode [halfline]
committed Details | Review

Description Pacho Ramos 2015-09-13 11:17:47 UTC
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `gnome-session'.
Program terminated with signal SIGSEGV, Segmentation fault.

Thread 2 (Thread 0x7f014699c980 (LWP 22952))

  • #0 g_uri_unescape_segment
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gurifuncs.c line 88
  • #1 _g_dbus_address_parse_entry
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusaddress.c line 480
  • #2 g_dbus_address_try_connect_one
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusaddress.c line 767
  • #3 g_dbus_address_get_stream_sync
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusaddress.c line 968
  • #4 initable_init
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusconnection.c line 2581
  • #5 g_bus_get_sync
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusconnection.c line 7057
  • #6 gsm_util_update_activation_environment
    at gsm-util.c line 462
  • #7 gsm_util_setenv
    at gsm-util.c line 510
  • #8 main
    at main.c line 350

Thread 1 (Thread 0x7f014699b700 (LWP 22997))

  • #0 getenv
    from /lib64/libc.so.6
  • #1 ??
    from /lib64/libc.so.6
  • #2 g_cancellable_set_error_if_cancelled
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gcancellable.c line 314
  • #3 g_socket_receive_message
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gsocket.c line 4434
  • #4 _g_socket_read_with_control_messages_ready
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusprivate.c line 139
  • #5 socket_source_dispatch
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gsocket.c line 3276
  • #6 g_main_dispatch
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gmain.c line 3122
  • #7 g_main_context_dispatch
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gmain.c line 3737
  • #8 g_main_context_iterate
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gmain.c line 3808
  • #9 g_main_loop_run
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gmain.c line 4002
  • #10 gdbus_shared_thread_func
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/gio/gdbusprivate.c line 274
  • #11 g_thread_proxy
    at /var/tmp/portage/dev-libs/glib-2.44.1/work/glib-2.44.1/glib/gthread.c line 764
  • #12 start_thread
    from /lib64/libpthread.so.0
  • #13 clone
    from /lib64/libc.so.6

Comment 1 Ray Strode [halfline] 2015-09-14 17:54:53 UTC
perhaps DBUS_SESSION_BUS_ADDRESS has invalid characters in it?
Comment 2 Pacho Ramos 2015-09-14 18:15:57 UTC
I will try to see the next time it occurs... I can only see that I didn't "manually" messed with that, but I have no idea if maybe something changed its value on its own or similar :/
Comment 3 Matthias Clasen 2016-03-01 21:34:46 UTC
This is just a typical "setenv is not threadsafe" crash - one thread is calling getenv (via gettext) while the other is calling setenv. Boom. We can't do that.
Comment 4 Matthias Clasen 2016-03-03 18:28:07 UTC
Some options we discussed:

- keep a separate environ array in gnome-session and use that when launching apps

- something else I forget now
Comment 5 Ray Strode [halfline] 2016-03-03 19:30:23 UTC
- try putenv instead and see if that doesn't crash because it has some handywavy comment in its man page about being reentrant
- try to convince gettext to stop calling getenv() every time it's run.
Comment 6 Matthias Clasen 2016-03-03 20:55:00 UTC
I sent a mail to Daiki, mentioning this bug
Comment 7 Michael Catanzaro 2016-03-04 19:32:53 UTC
Why do you pin this on gettext? I don't see that in the backtrace.

Isn't it better to not use setenv() after starting threads? Changing just gettext() doesn't really fix anything, that just papers over the problem....
Comment 8 Matthias Clasen 2016-03-04 19:42:37 UTC
The only case of setenv/genenv thread-safety crashes that I have ever seen is this one, where gettenv is called from gettext. Thats why I pin this is on gettext: it is simply the most common caller of getenv, and it is a bit insidious because gettext looks like it _should_ be threadsafe, in particular when it comes in the guise of _()
Comment 9 Ray Strode [halfline] 2016-03-07 20:53:03 UTC
Created attachment 323327 [details] [review]
main: don't use g_setenv after start up

It's not threadsafe and gettext makes us crash, so maintain child
environment separate from process environment.
Comment 10 Ray Strode [halfline] 2016-03-07 20:54:19 UTC
Attachment 323327 [details] pushed as 759b2b5 - main: don't use g_setenv after start up
Comment 11 Michael Catanzaro 2016-03-07 21:13:49 UTC
Nice to see it fixed properly, planning to cherry-pick to gnome-3-20?
Comment 12 Ray Strode [halfline] 2016-03-07 22:27:05 UTC
yea, i'm going to cherry-pick the things over from master before release on monday.  note there were a couple follow up fixes that I accidentally posted to bug 754941