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 659145 - Use g_app_info_launch_default_for_uri and g_app_launch_context_unsetenv instead of g_unsetenv and other launch commands
Use g_app_info_launch_default_for_uri and g_app_launch_context_unsetenv inste...
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.1.x
Other Linux
: Normal critical
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-15 13:13 UTC by Reda Lazri
Modified: 2013-12-14 20:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make g_setenv() calls early enough during startup (1.21 KB, patch)
2011-09-27 21:17 UTC, Claudio Saavedra
none Details | Review
make g_setenv() calls early enough during startup (2.12 KB, patch)
2011-09-27 22:02 UTC, Claudio Saavedra
committed Details | Review

Description Reda Lazri 2011-09-15 13:13:02 UTC
I'm using GNOME 3.1.91 from arch's gnome-unstable.

Here's a proper trace: 

http://pastebin.com/79dUKKsM
Comment 1 Akhil Laddha 2011-09-15 14:32:37 UTC
Please paste trace in bug next time.

(gdb) epiphany
Undefined command: "epiphany".  Try "help".
(gdb) run epiphany
Starting program: /usr/bin/epiphany epiphany
[Thread debugging using libthread_db enabled]
[New Thread 0xb39c2b70 (LWP 10222)]
[New Thread 0xb31c1b70 (LWP 10224)]
[New Thread 0xb29c0b70 (LWP 10228)]
[New Thread 0xb2095b70 (LWP 10229)]

Program received signal SIGSEGV, Segmentation fault.
0xb5ce8688 in strcmp () from /lib/libc.so.6
(gdb) bt
  • #0 strcmp
    from /lib/libc.so.6
  • #1 g_strcmp0
    from /usr/lib/libglib-2.0.so.0
  • #2 seed_gobject_define_property_from_function_info
    from /usr/lib/libseed-gtk3.so.0
  • #3 seed_struct_prototype
    from /usr/lib/libseed-gtk3.so.0
  • #4 seed_define_gtype_functions
    from /usr/lib/libseed-gtk3.so.0
  • #5 seed_gtype_init
    from /usr/lib/libseed-gtk3.so.0
  • #6 seed_init_with_context_and_group
    from /usr/lib/libseed-gtk3.so.0
  • #7 seed_init_with_context_group
    from /usr/lib/libseed-gtk3.so.0
  • #8 seed_init
    from /usr/lib/libseed-gtk3.so.0
  • #9 ephy_seed_extension_class_init
    at ephy-seed-extension.c line 269
  • #10 ephy_seed_extension_class_intern_init
    at ephy-seed-extension.c line 135
  • #11 g_type_class_ref
    from /usr/lib/libgobject-2.0.so.0
  • #12 g_object_new_valist
    from /usr/lib/libgobject-2.0.so.0
  • #13 g_object_new
    from /usr/lib/libgobject-2.0.so.0
  • #14 impl_get_object
    at ephy-seed-loader.c line 52
  • #15 ephy_loader_get_object
  • #16 load_extension
    at ephy-extensions-manager.c line 553
  • #17 sync_loaded_extensions
    at ephy-extensions-manager.c line 701
  • #18 ephy_extensions_manager_startup
    at ephy-extensions-manager.c line 978
  • #19 ephy_shell_get_extensions_manager
    at ephy-shell.c line 903
  • #20 ephy_shell_get_session
    at ephy-shell.c line 791
  • #21 queue_commands
    at ephy-shell.c line 135
  • #22 ephy_shell_activate
    at ephy-shell.c line 206
  • #23 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #24 ??
    from /usr/lib/libgobject-2.0.so.0
  • #25 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #26 ??
    from /usr/lib/libgobject-2.0.so.0
  • #27 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #28 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #29 g_application_activate
    from /usr/lib/libgio-2.0.so.0
  • #30 ??
    from /usr/lib/libgio-2.0.so.0
  • #31 g_application_run
    from /usr/lib/libgio-2.0.so.0
  • #32 main
    at ephy-main.c line 480

Comment 2 Akhil Laddha 2011-09-15 14:34:54 UTC
can you please install debuginfo packages of seed-gtk3, glib, gtk3 and gobject and provide us updated trace.
Comment 3 Reda Lazri 2011-09-16 10:14:58 UTC
Re-compiled, installed. It gives this!


Starting program: /usr/bin/epiphany epiphany
[Thread debugging using libthread_db enabled]

(epiphany:8062): Egg-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

[New Thread 0xb3a36b70 (LWP 8067)]
[New Thread 0xb3235b70 (LWP 8068)]

(epiphany:8062): GLib-GIO-CRITICAL **: Timeout was reached
[Thread 0xb3235b70 (LWP 8068) exited]
[Thread 0xb3a36b70 (LWP 8067) exited]
[Inferior 1 (process 8062) exited with code 01]
Comment 4 Reda Lazri 2011-09-16 10:29:16 UTC
(gdb) run epiphany
Starting program: /usr/bin/epiphany epiphany
[Thread debugging using libthread_db enabled]
[New Thread 0xb3a16b70 (LWP 27894)]
[New Thread 0xb3215b70 (LWP 27895)]
[New Thread 0xb28ffb70 (LWP 27896)]
[New Thread 0xb1fd4b70 (LWP 27897)]

Program received signal SIGSEGV, Segmentation fault.
0xb5d38688 in strcmp () from /lib/libc.so.6
(gdb) bt
  • #0 strcmp
    from /lib/libc.so.6
  • #1 g_strcmp0
    at gtestutils.c line 1540
  • #2 seed_gobject_define_property_from_function_info
    from /usr/lib/libseed-gtk3.so.0
  • #3 seed_struct_prototype
    from /usr/lib/libseed-gtk3.so.0
  • #4 seed_define_gtype_functions
    from /usr/lib/libseed-gtk3.so.0
  • #5 seed_gtype_init
    from /usr/lib/libseed-gtk3.so.0
  • #6 seed_init_with_context_and_group
    from /usr/lib/libseed-gtk3.so.0
  • #7 seed_init_with_context_group
    from /usr/lib/libseed-gtk3.so.0
  • #8 seed_init
    from /usr/lib/libseed-gtk3.so.0
  • #9 ephy_seed_extension_class_init
    at ephy-seed-extension.c line 269
  • #10 ephy_seed_extension_class_intern_init
    at ephy-seed-extension.c line 135
  • #11 type_class_init_Wm
    at gtype.c line 2212
  • #12 g_type_class_ref
    at gtype.c line 2912
  • #13 g_object_new_valist
    at gobject.c line 1571
  • #14 g_object_new
    at gobject.c line 1325
  • #15 impl_get_object
    at ephy-seed-loader.c line 52
  • #16 ephy_loader_get_object
    at ephy-loader.c line 59
  • #17 load_extension
    at ephy-extensions-manager.c line 553
  • #18 sync_loaded_extensions
    at ephy-extensions-manager.c line 701
  • #19 ephy_extensions_manager_startup
    at ephy-extensions-manager.c line 978
  • #20 ephy_shell_get_extensions_manager
    at ephy-shell.c line 903
  • #21 ephy_shell_get_session
    at ephy-shell.c line 791
  • #22 queue_commands
    at ephy-shell.c line 135
  • #23 ephy_shell_activate
    at ephy-shell.c line 206
  • #24 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 85
  • #25 g_type_class_meta_marshal
    at gclosure.c line 885
  • #26 g_closure_invoke
    at gclosure.c line 774
  • #27 signal_emit_unlocked_R
    at gsignal.c line 3310
  • #28 g_signal_emit_valist
    at gsignal.c line 3003
  • #29 g_signal_emit
    at gsignal.c line 3060
  • #30 g_application_activate
    at gapplication.c line 1122
  • #31 g_application_real_local_command_line
    at gapplication.c line 314
  • #32 g_application_run
    at gapplication.c line 1274
  • #33 main
    at ephy-main.c line 480

Comment 5 Dan Winship 2011-09-26 18:05:30 UTC
This is because of the issue described in bug 659326; setenv/putenv/unsetenv are not thread-safe. So, all environment munging needs to happen before the dbus thread is created (which currently happens when you call gsettings to check for lockdown, ephy-main.c:386)
Comment 6 Reda Lazri 2011-09-26 18:32:01 UTC
Everything is working fine in 3.1.92
Comment 7 Reda Lazri 2011-09-27 19:12:12 UTC
I take it back, it worked at first but I'm getting the same error again.
Comment 8 Claudio Saavedra 2011-09-27 21:11:37 UTC
Well, if it's only about the startup, this should be easily fixable by moving the g_setenv() call earlier in main()...
Comment 9 Claudio Saavedra 2011-09-27 21:17:35 UTC
Created attachment 197606 [details] [review]
Make g_setenv() calls early enough during startup

g_setenv() and getenv() are not thread-safe, so we need to make sure
that g_setenv() call in main is done earlier than anything that can
trigger a getenv() call.
Comment 10 Dan Winship 2011-09-27 21:19:03 UTC
there are other g_setenv()/g_unsetenv() calls elsewhere in the tree
Comment 11 Claudio Saavedra 2011-09-27 22:02:10 UTC
Created attachment 197611 [details] [review]
make g_setenv() calls early enough during startup

g_setenv() and getenv() are not thread-safe, so we need to make sure
that g_setenv() call in main is done earlier than anything that can
trigger a getenv() call.
Comment 12 Claudio Saavedra 2011-09-27 22:04:41 UTC
Comment on attachment 197606 [details] [review]
Make g_setenv() calls early enough during startup

I can't spot any other ephy calls besides these. Or do you mean something else?
Comment 13 Dan Winship 2011-09-28 13:34:19 UTC
(In reply to comment #12)
> (From update of attachment 197606 [details] [review])
> I can't spot any other ephy calls besides these. Or do you mean something else?

that covers the setenv()s, but unsetenv() is a problem too.

The unsetenv() cases are also harder to fix... hm... we probably want some new API at the glib level to help out here.

As far as it goes, the patch looks right, and will at least fix the "randomly fails to start up sometimes" problem. The unsetenv()s probably trigger the bug less often anyway, since there's not as much all-going-on-at-the-same-time-in-different-threads once startup is complete...
Comment 14 Dan Winship 2011-11-29 17:12:10 UTC
(In reply to comment #13)
> The unsetenv() cases are also harder to fix... hm... we probably want some new
> API at the glib level to help out here.

That happened, btw. ephy-window.c:policy_decision_required_cb() should use g_app_info_launch_default_for_uri() after using g_app_launch_context_unsetenv() on the launch context. Similarly in window-commands.c:notify_launch_cb().
Comment 15 Xan Lopez 2012-01-02 13:36:12 UTC
Comment on attachment 197611 [details] [review]
make g_setenv() calls early enough during startup

I've pushed this as 7b548bc81703ac315cfd7ccbc335f65adfe0ba89. Leaving the bug open to fix the rest of the calls.
Comment 16 Xan Lopez 2012-01-22 11:21:13 UTC
Actually the two remaining cases are pretty nasty hacks anyway, so making them safer is OK but ideally we should figure out something else entirely.
Comment 17 William Jon McCann 2013-12-14 20:31:50 UTC
The only g_setenv's are now in ephy_embed_shell_setup_environment() which is only called by   application_class->startup = ephy_embed_shell_startup;

While those setenvs may not be great I don't think there are any threading concerns with that. Will consider this fixed.