Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Program locks on exit (linux only)

This thread is locked; no one can reply to it. rss feed Print
Program locks on exit (linux only)
Michael Weiss
Member #223
April 2000

My project freezes when I exit in linux only.

I have to either kill it with the allegro special death key combo CTRL-ALT-END
or navigate to the terminal and CTRL-C

I have tried all kind of different options in Code::Blocks...
setting application type to console...GUI
unchecking pause on exit...

I am pretty sure I am shutting down allegro properly

And the exact same code works fine on the windows version.

Any thoughts or suggestions?

Mark Oates
Member #1,146
March 2001
avatar

Do you have a minimal code example that reproduces the problem?

If you have a complex codebase and it's too complicated to isolate, you might std::cout some message (with std::flush), between each point of destruction. If the lock is happening after the last return in main, I would guess you have resources in the global space that were not properly freed, or properly uninitialized, or were initialized or created out of sequence from the sequence of destruction.

Also, In the past I've found that I had objects that are being destructed in multiple places, or, had object trees that would loop through destruction of their children and get caught in some recursive or infinite loop.

Those are my thoughts, unfortunately I don't know exactly what to suggest unless I had a reproducible example.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Michael Weiss
Member #223
April 2000

Yes, I agree with you.
I will see if I can make a minimal example that reproduces the problem.
Just by doing so, I might very well find the answer myself.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Michael Weiss
Member #223
April 2000

I finally figured out how to use gdb to get a trace:

(gdb) bt
#0 0x00007ffff7e042a1 in pthread_cond_destroy@@GLIBC_2.3.2 ()
at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7ebb43f in al_destroy_event_queue () at /lib/liballegro_monolith.so.5.2
#2 0x00007ffff7eba5dc in _al_run_destructors () at /lib/liballegro_monolith.so.5.2
#3 0x00007ffff7ec1a40 in al_uninstall_system () at /lib/liballegro_monolith.so.5.2
#4 0x00005555555c500e in final_wrapup() () at /home/m/Desktop/pm_client22/src/z_main.cpp:572
#5 0x00005555555c6876 in main(int, char**) (argument_count=1, argument_array=0x7fffffffe1b8)
at /home/m/Desktop/pm_client22/src/z_main.cpp:1409
(gdb) where
#0 0x00007ffff7e042a1 in pthread_cond_destroy@@GLIBC_2.3.2 ()
at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7ebb43f in al_destroy_event_queue () at /lib/liballegro_monolith.so.5.2
#2 0x00007ffff7eba5dc in _al_run_destructors () at /lib/liballegro_monolith.so.5.2
#3 0x00007ffff7ec1a40 in al_uninstall_system () at /lib/liballegro_monolith.so.5.2
#4 0x00005555555c500e in final_wrapup() () at /home/m/Desktop/pm_client22/src/z_main.cpp:572
#5 0x00005555555c6876 in main(int, char**) (argument_count=1, argument_array=0x7fffffffe1b8)
at /home/m/Desktop/pm_client22/src/z_main.cpp:1409

I am not sure what this means...I think it means it is freezing
trying to destroy something some pthread under queue...

basically the last lines in my code are:

   printf("al_destroy_event_queue(event_queue)\n");
   al_destroy_event_queue(event_queue);

   printf("\nBefore al_uninstall_system()\n");
   al_uninstall_system();
   printf("\nAfter al_uninstall_system()\n");

It never prints the line after al_uninstall_system();

Does anyone have any insights or suggestions on other things I could try?

Update: I have done some more debugging:

In the allegro source I edited event.c

#SelectExpand
1 2void al_destroy_event_queue(ALLEGRO_EVENT_QUEUE *queue) 3{ 4 printf("deq 1\n"); 5 ASSERT(queue); 6 printf("deq 2\n"); 7 _al_unregister_destructor(_al_dtor_list, queue->dtor_item); 8 /* Unregister any event sources registered with this queue. */ 9 while (_al_vector_is_nonempty(&queue->sources)) { 10 ALLEGRO_EVENT_SOURCE **slot = _al_vector_ref_back(&queue->sources); 11 al_unregister_event_source(queue, *slot); 12 } 13 printf("deq 3\n"); 14 ASSERT(_al_vector_is_empty(&queue->sources)); 15 _al_vector_free(&queue->sources); 16 printf("deq 4\n"); 17 ASSERT(queue->events_head == queue->events_tail); 18 _al_vector_free(&queue->events); 19 printf("deq 5\n"); 20 _al_cond_destroy(&queue->cond); 21 printf("deq 6\n"); 22 _al_mutex_destroy(&queue->mutex); 23 printf("deq 7\n"); 24 al_free(queue); 25 printf("deq 8\n"); 26}

Now when I run my program I can see exactly how far it got:

Purple Martians Version 7.10
Allegro Version: 5.2.8.0
Desktop Resolution: 3840x2160
al_uninstall_audio()
al_destroy_font()
al_shutdown_ttf_addon()
al_shutdown_font_addon()
al_shutdown_image_addon()
al_shutdown_native_dialog_addon()
al_shutdown_primitives_addon()
al_unregister_event_source(event_queue, al_get_keyboard_event_source())
al_uninstall_keyboard()
al_unregister_event_source(event_queue, al_get_mouse_event_source())
al_uninstall_mouse()
al_unregister_event_source(event_queue, al_get_joystick_event_source())
al_uninstall_joystick()
al_unregister_event_source(event_queue, al_get_timer_event_source(mnu_timer));
al_unregister_event_source(event_queue, al_get_display_event_source(display))
al_destroy_display()
al_destroy_event_queue(event_queue)
deq 1
deq 2
deq 3
deq 4
deq 5
deq 6
deq 7
deq 8

Before al_uninstall_system()
deq 1
deq 2
deq 3
deq 4
deq 5

This is my code where I clean up before exit

#SelectExpand
1 2void final_wrapup(void) 3{ 4 save_display_window_position(); 5 6 printf("al_uninstall_audio()\n"); 7 al_uninstall_audio(); 8 9 printf("al_destroy_font()\n"); 10 al_destroy_font(font); 11 al_destroy_font(f1); 12 al_destroy_font(f2); 13 al_destroy_font(f3); 14 15 printf("al_shutdown_ttf_addon()\n"); 16 al_shutdown_ttf_addon(); 17 18 printf("al_shutdown_font_addon()\n"); 19 al_shutdown_font_addon(); 20 21 printf("al_shutdown_image_addon()\n"); 22 al_shutdown_image_addon(); 23 24 printf("al_shutdown_native_dialog_addon()\n"); 25 al_shutdown_native_dialog_addon(); 26 27 printf("al_shutdown_primitives_addon()\n"); 28 al_shutdown_primitives_addon(); 29 30 printf("al_unregister_event_source(event_queue, al_get_keyboard_event_source())\n"); 31 al_unregister_event_source(event_queue, al_get_keyboard_event_source()); 32 33 printf("al_uninstall_keyboard()\n"); 34 al_uninstall_keyboard(); 35 36 printf("al_unregister_event_source(event_queue, al_get_mouse_event_source())\n"); 37 al_unregister_event_source(event_queue, al_get_mouse_event_source()); 38 39 printf("al_uninstall_mouse()\n"); 40 al_uninstall_mouse(); 41 42 printf("al_unregister_event_source(event_queue, al_get_joystick_event_source())\n"); 43 al_unregister_event_source(event_queue, al_get_joystick_event_source()); 44 45 printf("al_uninstall_joystick()\n"); 46 al_uninstall_joystick(); 47 48 printf("al_unregister_event_source(event_queue, al_get_timer_event_source(mnu_timer));\n"); 49 al_unregister_event_source(event_queue, al_get_timer_event_source(mnu_timer)); 50 51 printf("al_unregister_event_source(event_queue, al_get_display_event_source(display))\n"); 52 al_unregister_event_source(event_queue, al_get_display_event_source(display)); 53 54 printf("al_destroy_display()\n"); 55 al_destroy_display(display); 56 57 printf("al_destroy_event_queue(event_queue)\n"); 58 al_destroy_event_queue(event_queue); 59 60 printf("\nBefore al_uninstall_system()\n"); 61 al_uninstall_system(); 62 printf("\nAfter al_uninstall_system()\n"); 63}

I used to just have the one line...al_uninstall_system();

I added all the other to troubleshoot this freezing problem

If I comment them all out so only al_uninstall_system(); is called, this is what I get:

Purple Martians Version 7.10
Allegro Version: 5.2.8.0
Desktop Resolution: 3840x2160

Before al_uninstall_system()
deq 1
deq 2
deq 3
deq 4
deq 5

It looks like the first call to al_destroy_event_queue(event_queue); works when I call it explicitly.

But when al_uninstall_system() calls it, it dies...

I tried to look up the function at the line it dies at:

_al_cond_destroy(&queue->cond);

But I am way out of my depth here...I could not make sense of anything

Could someone much smarter than I have a look and see?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You're getting closer. The backtrace doesn't show argument values for some reason. Were both allegro and your game compiled with debugging symbols?

Since your game is freezing, it's likely a deadlock in the destruction code.

Other useful commands in gdb :

info threads

thread apply all bt

thread #

frame #

You should take a look at where the other threads are when you hit CTRL-C.

Likely another thread is waiting in al_cond_wait .

Michael Weiss
Member #223
April 2000

I think I have all the debugging enabled:

Allegro:
-DCMAKE_BUILD_TYPE = {Debug | Release | RelWithDebInfo}
I used Debug

remade the library...
make
sudo make install

In the game:
compiler options: -Wall -g
link with -lallegro_monolith_debug

I ran gdb again and bt and where did not show anything new

I ran 'info threads' and 'thread apply all bt'

I got a lot more output, but nothing I can make sense of:

$ gdb ./pm
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./pm...
(gdb) run
Starting program: /home/m/Desktop/pm_client22/pm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4ca7700 (LWP 728683)]

Purple Martians Version 7.10
Allegro Version: 5.2.8.0
[Detaching after vfork from child process 728684]
System ID: Xglx
Desktop Resolution: 3840x2160
[New Thread 0x7fffebe03700 (LWP 728688)]
[New Thread 0x7fffe3fff700 (LWP 728689)]
[New Thread 0x7fffeb602700 (LWP 728690)]
[New Thread 0x7fffeae01700 (LWP 728691)]
[New Thread 0x7fffe9d42700 (LWP 728692)]
[New Thread 0x7fffe9541700 (LWP 728693)]
[New Thread 0x7fffe8b96700 (LWP 728694)]
[New Thread 0x7fffe37fe700 (LWP 728695)]
[New Thread 0x7fffe2f67700 (LWP 728696)]
[New Thread 0x7fffe2766700 (LWP 728697)]
[New Thread 0x7fffe1f65700 (LWP 728698)]
[New Thread 0x7fffe1764700 (LWP 728699)]
deq 1
deq 2
deq 3
deq 4
deq 5
^C
Thread 1 "pm" received signal SIGINT, Interrupt.
0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 ()
from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) bt
#0 0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 ()
at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7e2a503 in _al_cond_destroy (cond=0x7fffa4000be0)
at /home/m/Desktop/allegro5/include/allegro5/platform/aintuthr.h:76
#2 0x00007ffff7e22093 in al_destroy_event_queue (queue=0x7fffa4000b60)
at /home/m/Desktop/allegro5/src/events.c:152
#3 0x00007ffff7e21791 in _al_run_destructors (dtors=0x5555632f48e0)
at /home/m/Desktop/allegro5/src/dtor.c:120
#4 0x00007ffff7e32ec5 in al_uninstall_system () at /home/m/Desktop/allegro5/src/system.c:323
#5 0x00005555555c4f5a in final_wrapup() () at /home/m/Desktop/pm_client22/src/z_main.cpp:573
#6 0x00005555555c6888 in main(int, char**) (argument_count=1, argument_array=0x7fffffffe1b8)
at /home/m/Desktop/pm_client22/src/z_main.cpp:1421
(gdb) where
#0 0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 ()
at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7e2a503 in _al_cond_destroy (cond=0x7fffa4000be0)
at /home/m/Desktop/allegro5/include/allegro5/platform/aintuthr.h:76
#2 0x00007ffff7e22093 in al_destroy_event_queue (queue=0x7fffa4000b60)
at /home/m/Desktop/allegro5/src/events.c:152
#3 0x00007ffff7e21791 in _al_run_destructors (dtors=0x5555632f48e0)
at /home/m/Desktop/allegro5/src/dtor.c:120
#4 0x00007ffff7e32ec5 in al_uninstall_system () at /home/m/Desktop/allegro5/src/system.c:323
#5 0x00005555555c4f5a in final_wrapup() () at /home/m/Desktop/pm_client22/src/z_main.cpp:573
#6 0x00005555555c6888 in main(int, char**) (argument_count=1, argument_array=0x7fffffffe1b8)
at /home/m/Desktop/pm_client22/src/z_main.cpp:1421
(gdb) info threads
Id Target Id Frame

  • 1 Thread 0x7ffff4ca8cc0 (LWP 728679) "pm" 0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    2 Thread 0x7ffff4ca7700 (LWP 728683) "pm" 0x00007ffff7b528b3 in select ()

from /lib/x86_64-linux-gnu/libc.so.6
3 Thread 0x7fffebe03700 (LWP 728688) "pm:disk$0" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
4 Thread 0x7fffe3fff700 (LWP 728689) "pm:disk$1" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
5 Thread 0x7fffeb602700 (LWP 728690) "pm:disk$2" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
6 Thread 0x7fffeae01700 (LWP 728691) "pm:disk$3" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
7 Thread 0x7fffe9d42700 (LWP 728692) "gmain" 0x00007ffff7b503ff in poll ()
from /lib/x86_64-linux-gnu/libc.so.6
8 Thread 0x7fffe9541700 (LWP 728693) "gdbus" 0x00007ffff7b503ff in poll ()
from /lib/x86_64-linux-gnu/libc.so.6
9 Thread 0x7fffe8b96700 (LWP 728694) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
10 Thread 0x7fffe37fe700 (LWP 728695) "pm" 0x00007ffff7b528b3 in select ()
from /lib/x86_64-linux-gnu/libc.so.6
11 Thread 0x7fffe2f67700 (LWP 728696) "pm" 0x00007ffff7b22c61 in clock_nanosleep ()
from /lib/x86_64-linux-gnu/libc.so.6
12 Thread 0x7fffe2766700 (LWP 728697) "threaded-ml" 0x00007ffff7b503ff in poll ()
from /lib/x86_64-linux-gnu/libc.so.6
13 Thread 0x7fffe1f65700 (LWP 728698) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
14 Thread 0x7fffe1764700 (LWP 728699) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) info threads
Id Target Id Frame

  • 1 Thread 0x7ffff4ca8cc0 (LWP 728679) "pm" 0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    2 Thread 0x7ffff4ca7700 (LWP 728683) "pm" 0x00007ffff7b528b3 in select () from /lib/x86_64-linux-gnu/libc.so.6
    3 Thread 0x7fffebe03700 (LWP 728688) "pm:disk$0" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    4 Thread 0x7fffe3fff700 (LWP 728689) "pm:disk$1" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    5 Thread 0x7fffeb602700 (LWP 728690) "pm:disk$2" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    6 Thread 0x7fffeae01700 (LWP 728691) "pm:disk$3" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    7 Thread 0x7fffe9d42700 (LWP 728692) "gmain" 0x00007ffff7b503ff in poll () from /lib/x86_64-linux-gnu/libc.so.6
    8 Thread 0x7fffe9541700 (LWP 728693) "gdbus" 0x00007ffff7b503ff in poll () from /lib/x86_64-linux-gnu/libc.so.6
    9 Thread 0x7fffe8b96700 (LWP 728694) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    10 Thread 0x7fffe37fe700 (LWP 728695) "pm" 0x00007ffff7b528b3 in select () from /lib/x86_64-linux-gnu/libc.so.6
    11 Thread 0x7fffe2f67700 (LWP 728696) "pm" 0x00007ffff7b22c61 in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
    12 Thread 0x7fffe2766700 (LWP 728697) "threaded-ml" 0x00007ffff7b503ff in poll () from /lib/x86_64-linux-gnu/libc.so.6
    13 Thread 0x7fffe1f65700 (LWP 728698) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    14 Thread 0x7fffe1764700 (LWP 728699) "pm" 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0

(gdb) thread apply all bt

Thread 14 (Thread 0x7fffe1764700 (LWP 728699) "pm"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7e2a52d in _al_cond_wait (cond=0x7fffa4000be0, mutex=0x7fffa4000bb0) at /home/m/Desktop/allegro5/include/allegro5/platform/aintuthr.h:81
#2 0x00007ffff7e22c4f in al_wait_for_event (queue=0x7fffa4000b60, ret_event=0x7fffe1763820) at /home/m/Desktop/allegro5/src/events.c:435
#3 0x00007ffff7f396b0 in _al_kcm_feed_stream (self=0x555563568700, vstream=0x5555639d0900) at /home/m/Desktop/allegro5/addons/audio/kcm_stream.c:697
#4 0x00007ffff7e339ac in thread_func_trampoline (inner=0x555563568700, _outer=0x555563568700) at /home/m/Desktop/allegro5/src/threads.c:80
#5 0x00007ffff7ed404c in thread_proc_trampoline (data=0x555563568700) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#6 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 13 (Thread 0x7fffe1f65700 (LWP 728698) "pm"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff744eda8 in pa_threaded_mainloop_wait () at /lib/x86_64-linux-gnu/libpulse.so.0
#2 0x00007ffff7470a78 in pa_simple_write () at /lib/x86_64-linux-gnu/libpulse-simple.so.0
#3 0x00007ffff7f3d5c9 in pulseaudio_update (self=0x55556387d1d0, data=0x55556388dfd0) at /home/m/Desktop/allegro5/addons/audio/pulseaudio.c:212
#4 0x00007ffff7e339ac in thread_func_trampoline (inner=0x55556387d1d0, _outer=0x55556387d1d0) at /home/m/Desktop/allegro5/src/threads.c:80
#5 0x00007ffff7ed404c in thread_proc_trampoline (data=0x55556387d1d0) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#6 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 12 (Thread 0x7fffe2766700 (LWP 728697) "threaded-ml"):
#0 0x00007ffff7b503ff in poll () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff744e632 in () at /lib/x86_64-linux-gnu/libpulse.so.0
#2 0x00007ffff7440079 in pa_mainloop_poll () at /lib/x86_64-linux-gnu/libpulse.so.0
#3 0x00007ffff74406ff in pa_mainloop_iterate () at /lib/x86_64-linux-gnu/libpulse.so.0
#4 0x00007ffff74407b0 in pa_mainloop_run () at /lib/x86_64-linux-gnu/libpulse.so.0
#5 0x00007ffff744e709 in () at /lib/x86_64-linux-gnu/libpulse.so.0
#6 0x00007ffff625be08 in () at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-14.2.so
#7 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 11 (Thread 0x7fffe2f67700 (LWP 728696) "pm"):
#0 0x00007ffff7b22c61 in clock_nanosleep () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7b28443 in nanosleep () at /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff7ed3e79 in _al_unix_rest (seconds=0.0096502640000000039) at /home/m/Desktop/allegro5/src/unix/utime.c:68
#3 0x00007ffff7e33803 in al_rest (seconds=0.0096502640000000039) at /home/m/Desktop/allegro5/src/system.c:520
#4 0x00007ffff7e34c37 in timer_thread_proc (self=0x5555635fbea0, unused=0x0) at /home/m/Desktop/allegro5/src/timernu.c:94
#5 0x00007ffff7ed404c in thread_proc_trampoline (data=0x5555635fbea0) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#6 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 10 (Thread 0x7fffe37fe700 (LWP 728695) "pm"):
#0 0x00007ffff7b528b3 in select () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7ed2d8f in fd_watch_thread_func (self=0x7ffff7fa9d80 <fd_watch_thread>, unused=0x0) at /home/m/Desktop/allegro5/src/unix/ufdwatch.c:89
#2 0x00007ffff7ed404c in thread_proc_trampoline (data=0x7ffff7fa9d80 <fd_watch_thread>) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 9 (Thread 0x7fffe8b96700 (LWP 728694) "pm"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7e2a52d in _al_cond_wait (cond=0x5555635fdeb0, mutex=0x555563590400) at /home/m/Desktop/allegro5/include/allegro5/platform/aintuthr.h:81
#2 0x00007ffff7e3492e in al_wait_cond (cond=0x5555635fdeb0, mutex=0x555563590400) at /home/m/Desktop/allegro5/src/threads.c:380
#3 0x00007ffff7ee8c8d in hotplug_proc (thread=0x5555635709e0, data=0x0) at /home/m/Desktop/allegro5/src/linux/ljoynu.c:658
#4 0x00007ffff7e339ac in thread_func_trampoline (inner=0x5555635709e0, _outer=0x5555635709e0) at /home/m/Desktop/allegro5/src/threads.c:80
#5 0x00007ffff7ed404c in thread_proc_trampoline (data=0x5555635709e0) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#6 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#7 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 8 (Thread 0x7fffe9541700 (LWP 728693) "gdbus"):
#0 0x00007ffff7b503ff in poll () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff65ee0ae in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff65ee40b in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff5cdfa36 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#4 0x00007ffff66170bd in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#6 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 7 (Thread 0x7fffe9d42700 (LWP 728692) "gmain"):
#0 0x00007ffff7b503ff in poll () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff65ee0ae in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff65ee1cf in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff65ee221 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff66170bd in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#6 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 6 (Thread 0x7fffeae01700 (LWP 728691) "pm:disk$3"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff2e175db in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
--Type <RET> for more, q to quit, c to continue without paging--c
#2 0x00007ffff2e170a7 in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 5 (Thread 0x7fffeb602700 (LWP 728690) "pm:disk$2"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff2e175db in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#2 0x00007ffff2e170a7 in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 4 (Thread 0x7fffe3fff700 (LWP 728689) "pm:disk$1"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff2e175db in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#2 0x00007ffff2e170a7 in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 3 (Thread 0x7fffebe03700 (LWP 728688) "pm:disk$0"):
#0 0x00007ffff7d757b2 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff2e175db in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#2 0x00007ffff2e170a7 in () at /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 2 (Thread 0x7ffff4ca7700 (LWP 728683) "pm"):
#0 0x00007ffff7b528b3 in select () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7ed9b9a in _al_xwin_background_thread (self=0x5555632e13f8, arg=0x5555632e1390) at /home/m/Desktop/allegro5/src/x/xevents.c:243
#2 0x00007ffff7ed404c in thread_proc_trampoline (data=0x5555632e13f8) at /home/m/Desktop/allegro5/src/unix/uxthread.c:44
#3 0x00007ffff7d6eea7 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0
#4 0x00007ffff7b5adef in clone () at /lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 0x7ffff4ca8cc0 (LWP 728679) "pm"):
#0 0x00007ffff7d752a1 in pthread_cond_destroy@@GLIBC_2.3.2 () at /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff7e2a503 in _al_cond_destroy (cond=0x7fffa4000be0) at /home/m/Desktop/allegro5/include/allegro5/platform/aintuthr.h:76
#2 0x00007ffff7e22093 in al_destroy_event_queue (queue=0x7fffa4000b60) at /home/m/Desktop/allegro5/src/events.c:152
#3 0x00007ffff7e21791 in _al_run_destructors (dtors=0x5555632f48e0) at /home/m/Desktop/allegro5/src/dtor.c:120
#4 0x00007ffff7e32ec5 in al_uninstall_system () at /home/m/Desktop/allegro5/src/system.c:323
#5 0x00005555555c4f5a in final_wrapup() () at /home/m/Desktop/pm_client22/src/z_main.cpp:573
#6 0x00005555555c6888 in main(int, char**) (argument_count=1, argument_array=0x7fffffffe1b8) at /home/m/Desktop/pm_client22/src/z_main.cpp:1421

UPDATE:

From the clues above (pulseaudio and kcm_stream) I started looking at audio...

When I commented out all my audio references the program exits clean!

I think I know where the problem is now....

Yes!

I was not destroying an audio stream I had created...I feel so dumb...

Well at least I learned a few things about how to debug....

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

There are lots of threads started with clone. I don't think you have to worry about those.

The timer thread is still running, as well as two audio threads.

What happens if you don't call al_uninstall_system at all? It should still be registered with atexit if you use al_init to initialize allegro.

I have Ubuntu 18.04 running in a VM. I could debug it there if you can provide src or binaries.

UPDATE
Per your update - glad you figured it out. Apparently allegro doesn't keep track of audio streams. It does keep track of bitmaps tied to displays, and timers, and event queues though.

Mark Oates
Member #1,146
March 2001
avatar

I think I know where the problem is now....

Yes!

I was not destroying an audio stream I had created...I feel so dumb...

OMG YAAAY!

Congrats. I was worried about this.

You seem to have put a lot of time/effort into whatever it is you're working on. I'm curious, what's your project?

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Michael Weiss
Member #223
April 2000

My project is Purple Martians

I started it in 1997 with Allegro 2.2

It works identically in windows and linux.

The most difficult and rewarding thing I did with it is the networked multiplayer.

I recently just figured out how to use github for hosting webpages.
Here is the link to the project description webpages I just posted:

https://mweiss001.github.io/

Here is my project page on allegro.cc:

https://www.allegro.cc/depot/PurpleMartians/

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I played a ton of Purple Martians on Windows until it just got too hard for me to keep up somewhere around 3/4 of the way through the game. Lots of hours of enjoyment though, figuring out the levels and having fun with the game mechanics. ;)

Mark Oates
Member #1,146
March 2001
avatar

What are you playing with usually? Keyboard/Mouse? Joystick?

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Michael Weiss
Member #223
April 2000

Thanks Edgar. That means a lot to me that you enjoyed the gameplay!

I am currently designing a bunch of new levels.
I was not satisfied with the quality of levels in the older versions.

There were too many boring places where you retrace you steps many times to kill every last enemy.

I always thought there was so much more that I could do with level design...

I like the puzzle based ones, kind of like the portal test chambers.
You have to take items to specific place in specific orders...

But unlike portal, you have to kill things also...

I exclusively play with the keyboard. IJKL for direction, space for jump and C for fire. That is just where my hands naturally fall on the keyboard.

Mark Oates
Member #1,146
March 2001
avatar

You know, just a few days ago I stumbled upon some good level design tutorial/tips graphics on pinterest. Here's an example:

{"name":"613140","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/49ccd3071d8c37ed093d241bc8fdfb6b.jpg","w":2112,"h":1188,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/49ccd3071d8c37ed093d241bc8fdfb6b"}613140

It's this guy Tommy Norberg (site) who has made his entire brand just around level design and level design education. He focuses almost entirely on competition style levels (fps or pvp) because, apparently, that's where all the hottest design theory is.

He has a twitter, you might check out his pics on google for inspiration.

Any one of those could spark an entire idea for level design.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Go to: