Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault from Mix_CloseAudio() #202

Open
seisatsu opened this issue Jan 28, 2018 · 7 comments
Open

Segfault from Mix_CloseAudio() #202

seisatsu opened this issue Jan 28, 2018 · 7 comments

Comments

@seisatsu
Copy link
Member

seisatsu commented Jan 28, 2018

I am experiencing a segfault on exit again. It looks like it's been around for quite a few commits.

Currently, Mix_CloseAudio() is commented out in our code as a workaround. We should concurrently investigate if there are any unwanted consequences from this besides the memory being held a bit longer on engine shutdown.

@seisatsu seisatsu added the bug label Jan 28, 2018
@seisatsu
Copy link
Member Author

Looks like it's originating from Mix_CloseAudio(). Didn't we have trouble with this before? This is that Linux-specific bug isn't it.

@seisatsu seisatsu changed the title More segfault-on-exit! Segfault from Mix_CloseAudio() Jan 28, 2018
@pmer
Copy link
Member

pmer commented Jan 28, 2018

If you install debug symbols for SDL2_mixer you can run Driftwood inside a debugger and find out where it's crashing.

@seisatsu
Copy link
Member Author

seisatsu commented Jan 29, 2018

I assume it's related to #70, but on my current system, the commit from back then that fixed it still segfaults. It must be somewhat dependent on the system running it. Installing debugging symbols gave little insight.

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007fffd807b210 in ?? ()
(gdb) bt
#0  0x00007fffd807b210 in ?? ()
#1  0x00007fffebdc3c5d in close_music () at music.c:939
#2  0x00007fffebdc2331 in Mix_CloseAudio () at mixer.c:1235
#3  0x00007ffff5edff0e in ffi_call_unix64 () from /usr/lib/libffi.so.6
#4  0x00007ffff5edf87f in ffi_call () from /usr/lib/libffi.so.6
#5  0x00007ffff60f31b5 in _ctypes_callproc () from /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so
#6  0x00007ffff60ed466 in ?? () from /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so
#7  0x00007ffff796b3a9 in _PyObject_FastCallDict () from /usr/lib/libpython3.6m.so.1.0
#8  0x00007ffff7a24ada in ?? () from /usr/lib/libpython3.6m.so.1.0
#9  0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#10 0x00007ffff7a23def in ?? () from /usr/lib/libpython3.6m.so.1.0
#11 0x00007ffff7a24b85 in ?? () from /usr/lib/libpython3.6m.so.1.0
#12 0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#13 0x00007ffff7a23def in ?? () from /usr/lib/libpython3.6m.so.1.0
#14 0x00007ffff7a24b85 in ?? () from /usr/lib/libpython3.6m.so.1.0
#15 0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#16 0x00007ffff7a23def in ?? () from /usr/lib/libpython3.6m.so.1.0
#17 0x00007ffff7a24b85 in ?? () from /usr/lib/libpython3.6m.so.1.0
#18 0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#19 0x00007ffff7a247d6 in ?? () from /usr/lib/libpython3.6m.so.1.0
#20 0x00007ffff7a24d2e in PyEval_EvalCodeEx () from /usr/lib/libpython3.6m.so.1.0
#21 0x00007ffff7a24d5b in PyEval_EvalCode () from /usr/lib/libpython3.6m.so.1.0
#22 0x00007ffff7a21ccd in ?? () from /usr/lib/libpython3.6m.so.1.0
#23 0x00007ffff79b38cd in _PyCFunction_FastCallDict () from /usr/lib/libpython3.6m.so.1.0
#24 0x00007ffff7a24ca2 in ?? () from /usr/lib/libpython3.6m.so.1.0
#25 0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#26 0x00007ffff7a247d6 in ?? () from /usr/lib/libpython3.6m.so.1.0
#27 0x00007ffff7a2497f in ?? () from /usr/lib/libpython3.6m.so.1.0
#28 0x00007ffff7a24b85 in ?? () from /usr/lib/libpython3.6m.so.1.0
#29 0x00007ffff7a27857 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.6m.so.1.0
#30 0x00007ffff7a247d6 in ?? () from /usr/lib/libpython3.6m.so.1.0
#31 0x00007ffff7a24d2e in PyEval_EvalCodeEx () from /usr/lib/libpython3.6m.so.1.0
#32 0x00007ffff79951c5 in ?? () from /usr/lib/libpython3.6m.so.1.0
#33 0x00007ffff796b238 in PyObject_Call () from /usr/lib/libpython3.6m.so.1.0
#34 0x00007ffff7a6561d in ?? () from /usr/lib/libpython3.6m.so.1.0
#35 0x00007ffff7a668b7 in Py_Main () from /usr/lib/libpython3.6m.so.1.0
#36 0x0000555555554b30 in main ()

@pmer
Copy link
Member

pmer commented Jan 29, 2018

Well, the easy fix would be to not call Mix_CloseAudio in production builds. :)

seisatsu added a commit that referenced this issue Jan 29, 2018
@seisatsu
Copy link
Member Author

seisatsu commented Jan 29, 2018

Brilliant! I hope this doesn't have any unintended consequences aside from some memory being held for a few milliseconds longer at shutdown. We should look into that.

@pmer
Copy link
Member

pmer commented Dec 10, 2022

Looking at the code for these two functions: Mix_Quit() and Mix_CloseAudio(). Just a guess, but I wonder if we were calling them in the wrong order.

@pmer
Copy link
Member

pmer commented Dec 11, 2022

Might be fixed in #212.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants