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 579738 - seahorse-agent leaves behind its socket dir
seahorse-agent leaves behind its socket dir
Status: RESOLVED WONTFIX
Product: seahorse-plugins
Classification: Applications
Component: Agent
unspecified
Other Linux
: Normal normal
: 2.24
Assigned To: seahorse-plugins-maint
seahorse-plugins-maint
gnome[unmaintained]
: 560784 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-04-21 16:03 UTC by Matthias Clasen
Modified: 2020-06-06 08:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds a atexit handler (1.26 KB, patch)
2009-04-22 18:48 UTC, Adam Schreiber
none Details | Review
Moves atexit call (1.45 KB, patch)
2009-04-22 20:03 UTC, Adam Schreiber
committed Details | Review
dont_crash_on_exit.patch (1.51 KB, patch)
2009-11-09 23:25 UTC, Chris Coulson
none Details | Review

Description Matthias Clasen 2009-04-21 16:03:35 UTC
I see it has code to clean it up on sigint and sigterm, but it misses the one way in which it actually gets killed, an xioerrorhandler.
Comment 1 Adam Schreiber 2009-04-22 16:34:53 UTC
I'm not familiar with that type of error.  A google search didn't readily turn up any documentation on it.  Do you have a doc reference or a pointer to some code where it's handled?
Comment 2 Matthias Clasen 2009-04-22 18:15:48 UTC
I think seahorse-agent gets killed by loosing its X connection, in Fedora at least. Xlib helpfully calls exit for you in that case. The way to handle that is to either use XSetIOErrorHandler to install an error handler, or use atexit for final cleanups. Small caveat: Xlib will still call exit after your io error handler returns, so if you want to survive longer (e.g. return to the mainloop, you need to longjmp out of your io error handler...
Comment 3 Adam Schreiber 2009-04-22 18:48:29 UTC
Created attachment 133137 [details] [review]
Adds a atexit handler

Could you test this patch that adds an atexit handler that wraps the uninit code?
Comment 4 Matthias Clasen 2009-04-22 19:36:38 UTC
You need to install the atexit handler in the child, after the fork. 
With that change, it works fine.
Comment 5 Adam Schreiber 2009-04-22 20:03:59 UTC
Created attachment 133143 [details] [review]
Moves atexit call

This patch moves the atext call below the daemonize call.  Please confirm that this is what you meant.
Comment 6 Matthias Clasen 2009-04-22 20:37:45 UTC
Yes, that is the patch that I just added to the fedora package, thanks.
Comment 7 Adam Schreiber 2009-04-22 20:47:21 UTC
commit 02140f48f3532e1a896a56fbab1f7935f8041c48
Author: Adam Schreiber <sadam@gnome.org>
Date:   Wed Apr 22 16:41:11 2009 -0400

    Bug 579738 – seahorse-agent leaves behind its socket dir
    
    Add an atexit() handler after forking the child process.
Comment 8 Chris Coulson 2009-11-06 00:57:28 UTC
This probably needs a bit more thought. This change makes it crash on exit now, and is getting a lot of duplicates on Launchpad (see https://bugs.launchpad.net/ubuntu/+source/seahorse-plugins/+bug/429322), and is reported at https://bugzilla.redhat.com/show_bug.cgi?id=524415 as well

The trace looks like:

  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 92
  • #2 IA__g_assertion_message
  • #3 IA__g_assertion_message_expr
    at /build/buildd/glib2.0-2.22.2/glib/gtestutils.c line 1328
  • #4 IOP_generate_profiles
    at iop-profiles.c line 606
  • #5 ORBit_marshal_object
    at corba-object.c line 573
  • #6 ORBit_marshal_value
    at corba-any.c line 173
  • #7 orbit_small_marshal
    at orbit-small.c line 355
  • #8 ORBit_small_invoke_stub
    at orbit-small.c line 648
  • #9 ConfigDatabase3_add_listener_with_properties
    at GConfX-stubs.c line 234
  • #10 gconf_engine_notify_add
    at gconf.c line 837
  • #11 gconf_client_add_dir
    at gconf-client.c line 569
  • #12 get_global_client
    at seahorse-gconf.c line 76
  • #13 seahorse_gconf_unnotify
    at seahorse-gconf.c line 294
  • #14 seahorse_agent_status_cleanup
    at seahorse-agent-status.c line 325
  • #15 seahorse_agent_uninit
    at seahorse-agent.c line 154
  • #16 __run_exit_handlers
    at exit.c line 78
  • #17 *__GI_exit
    at exit.c line 100
  • #18 gdk_x_io_error
    at /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkmain-x11.c line 524
  • #19 _XIOError
    at ../../src/XlibInt.c line 2959
  • #20 process_responses
    at ../../src/xcb_io.c line 240
  • #21 _XEventsQueued
    at ../../src/xcb_io.c line 256
  • #22 XPending
    at ../../src/Pending.c line 56
  • #23 gdk_check_xpending
    at /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkevents-x11.c line 154
  • #24 gdk_event_check
    at /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkevents-x11.c line 2344
  • #25 IA__g_main_context_check
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2469
  • #26 g_main_context_iterate
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2588
  • #27 IA__g_main_loop_run
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2799
  • #28 IA__gtk_main
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkmain.c line 1218
  • #29 main
    at seahorse-agent-main.c line 281

Comment 9 Matthias Clasen 2009-11-07 01:02:33 UTC
Just to be clear, 99% of what seahorse_agent_uninit does is pointless or harmful.
The one thing we need to do here is remove the socket. Destroying widgets, unreffing objects, all that is entirely futile when the process is about to end anyway.

And notice that there is likely interference with atexit handlers that are installed in libseahorse.

And finally there's a mixture between atexit and g_atexit here. 

My recommendation is: nuke all use of atexit, then add a single atexit handler that does nothing but cleaning up the socket dir.
Comment 10 Chris Coulson 2009-11-09 23:25:58 UTC
Created attachment 147342 [details] [review]
dont_crash_on_exit.patch

Here is a patch that we're going to apply as a stable update in Ubuntu. It doesn't fully implement all of the suggestions above, but it does fix the crash and still removes the socket on exit, which was the original intention of this change.

FYI, the handler which interferes with seahorse and triggers this crash is shutdown_orb() in liborbit
Comment 11 Adam Schreiber 2009-11-29 22:10:23 UTC
Matthias:  I'm not sure it's possible to remove the atexit calls from libseahorse without unintended consequences.  Would Chris's patch be acceptable to you?
Comment 12 Adam Schreiber 2009-11-29 22:40:20 UTC
*** Bug 560784 has been marked as a duplicate of this bug. ***
Comment 13 André Klapper 2020-06-06 08:52:10 UTC
seahorse-plugins is not under active development anymore:
https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/257

It had its last code changes many years ago:
https://gitlab.gnome.org/GNOME/seahorse-plugins/-/commits/master

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect
reality. Please feel free to reopen this ticket (or rather transfer the project
to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the
responsibility for active development again.