GNOME Bugzilla – Bug 579738
seahorse-agent leaves behind its socket dir
Last modified: 2020-06-06 08:52:10 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.
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?
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...
Created attachment 133137 [details] [review] Adds a atexit handler Could you test this patch that adds an atexit handler that wraps the uninit code?
You need to install the atexit handler in the child, after the fork. With that change, it works fine.
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.
Yes, that is the patch that I just added to the fedora package, thanks.
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.
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:
+ Trace 218856
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.
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
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?
*** Bug 560784 has been marked as a duplicate of this bug. ***
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.