Project

General

Profile

Session save and restore?

Added by Michael Schwendt over 8 years ago

As I don't remember whether it has worked before, let me ask what's wrong currently? When running Audacious and logging out of a GNOME session, Audacious crashes instead of terminating in a sane way or getting killed:

INFO interface.cc:69 [interface_load]: Loading GTK Interface.
audacious: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
...
WARNING strpool.cc:233 [leak_cb]: String leaked: it
WARNING strpool.cc:233 [leak_cb]: String leaked: -1
WARNING strpool.cc:233 [leak_cb]: String leaked: 
WARNING strpool.cc:233 [leak_cb]: String leaked: sndfile
WARNING strpool.cc:233 [leak_cb]: String leaked: 16
...
[lots of those]
...
WARNING runtime.cc:357 [aud_leak_check]: Bytes allocated at exit: 5484
audacious: strpool.cc:224: static void String::raw_unref(char*): Assertion `status & MultiHash::Found' failed.

One can achieve the same by simply killing the X server while Audacious is still running.


Replies (5)

RE: Session save and restore? - Added by Michael Schwendt over 8 years ago

Interrupting Audacious like that (e.g. by taking away the X server) causes it to not run its aud_cleanup() method.

Attaching gdb to it to find out how it arrives in the aud_leak_check() method, this is the backtrace:

#0 0x000055cb89072040 in aud_leak_check()@plt ()
#1 0x00007fa24c178658 in __run_exit_handlers () from /lib64/libc.so.6
#2 0x00007fa24c1786a5 in exit () from /lib64/libc.so.6

(!)

#3 0x00007fa22a7b88b1 in gdk_x_io_error () from /lib64/libgdk-x11-2.0.so.0
#4 0x00007fa24972a43e in _XIOError () from /lib64/libX11.so.6
#5 0x00007fa24972849a in _XReply () from /lib64/libX11.so.6
#6 0x00007fa24970e6f1 in XGetSelectionOwner () from /lib64/libX11.so.6
#7 0x00007fa22a7cc34e in check_manager_window () from /lib64/libgdk-x11-2.0.so.0
#8 0x00007fa22a7cc701 in _gdk_xsettings_client_process_event () from /lib64/libgdk-x11-2.0.so.0
#9 0x00007fa22a7ac843 in gdk_xsettings_client_event_filter () from /lib64/libgdk-x11-2.0.so.0
#10 0x00007fa22a7ace71 in gdk_event_apply_filters () from /lib64/libgdk-x11-2.0.so.0
#11 0x00007fa22a7ae5ca in gdk_event_translate () from /lib64/libgdk-x11-2.0.so.0
#12 0x00007fa22a7b06d6 in _gdk_events_queue () from /lib64/libgdk-x11-2.0.so.0
#13 0x00007fa22a7b077e in gdk_event_dispatch () from /lib64/libgdk-x11-2.0.so.0
#14 0x00007fa24cde4e3a in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#15 0x00007fa24cde51d0 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0

#16 0x00007fa24cde54f2 in g_main_loop_run () from /lib64/libglib-2.0.so.0
#17 0x00007fa22ab57f37 in gtk_main () from /lib64/libgtk-x11-2.0.so.0
#18 0x00007fa24d8db628 in interface_run() () from /lib64/libaudcore.so.3
#19 0x00007fa24d8ecea8 in aud_run() () from /lib64/libaudcore.so.3
#20 0x000055cb89072920 in main ()

RE: Session save and restore? - Added by Michael Schwendt over 8 years ago

audacious/main.cc
301 static void main_cleanup (void)
302 {
303 filenames.clear ();
304 aud_cleanup_paths ();
305 aud_leak_check ();
306 }
307

320  int main (int argc, char * * argv)
321 {
322 atexit (main_cleanup);
323

So, the exit() handler it registers is not safe, since it doesn't not involve aud_cleanup():

libaudcore/runtime.cc
327 EXPORT void aud_cleanup ()
328 {
329 save_playlists (true);
330
331 aud_playlist_play (-1);
332 playback_stop (true);
333
334 adder_cleanup ();
335 playlist_enable_scan (false);
336 scanner_cleanup ();
337
338 stop_plugins_one ();
339
340 art_cleanup ();
341 chardet_cleanup ();
342 eq_cleanup ();
343 playlist_end ();
344
345 event_queue_cancel_all ();
346 hook_cleanup ();
347
348 config_save ();
349 config_cleanup ();
350 }
351

RE: Session save and restore? - Added by John Lindgren over 8 years ago

aud_cleanup is not safe to call from an exit handler, since it would attempt to shut down the plugin that exit() was called from (and plugins are not required to be reentrant to that degree). So in the case of an unexpected call to exit(), we should just skip aid_leak_check. The trickier problem is how to handle static String objects being destroyed after the string pool itself is destroyed.

RE: Session save and restore? - Added by Michael Schwendt over 8 years ago

aud_cleanup is not safe to call from an exit handler

I had wondered about the different quit/cleanup methods, since the atexit handler is to be called at normal program termination. But what to clean up at that point is both a matter of definition (e.g. whether to update config/status files) and depends on what can be cleaned up after an exit() call done anywhere.

    (1-5/5)