[pulseaudio-discuss] [BUG]PulseAudio Python Binding PyEval_CallFunction segfault in pa_mainloop_dispatch based on pa_threaded_mainloop
Xiang Zhai
xiangzhai83 at gmail.com
Sat Feb 23 03:03:28 PST 2013
于 2013年02月23日 11:34, Xiang Zhai 写道:
> Hi PulseAudio developers,
>
> I am developing PulseAudio Python Binding in C based on
> pa_threaded_mainloop to handle pa_context_subscribe callback.
>
> For example, when received PA_SUBSCRIPTION_EVENT_SINK
> PA_SUBSCRIPTION_EVENT_CHANGE event, I used PyEval_CallFunction to call
> Python (pygtk.py) callback.
> Then pygtk.py testcase throw segfault, gdb DEBUG shown as below:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffebb3f700 (LWP 10150)]
> 0x00000000004e9f20 in PyObject_Call ()
> (gdb) bt
> #0 0x00000000004e9f20 in PyObject_Call ()
> #1 0x00000000004ea396 in PyEval_CallObjectWithKeywords ()
> #2 0x0000000000478a99 in PyEval_CallFunction ()
> #3 0x00007fffed1969b6 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #4 0x00007fffecd45693 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #5 0x00007fffecd45a03 in pa_pdispatch_run () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #6 0x00007fffed18cbdd in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #7 0x00007fffecd4a2a9 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #8 0x00007fffed19fa1e in pa_mainloop_dispatch () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #9 0x00007fffed19fde5 in pa_mainloop_iterate () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #10 0x00007fffed19fe90 in pa_mainloop_run () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #11 0x00007fffed1ae30f in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #12 0x00007fffecd57d18 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #13 0x00007ffff7bc4e9a in start_thread (arg=0x7fffebb3f700) at
> pthread_create.c:308
> #14 0x00007ffff69b3cbd in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #15 0x0000000000000000 in ?? ()
>
> I tried to add PyGILState_Ensure() & PyGILState_Release() around
> PyEval_CallFunction() for locking/unlocking, it still throw another
> segfault shown as below:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffebb3f700 (LWP 10362)]
> sem_post () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S:34
> (gdb) bt
> #0 sem_post () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S:34
> #1 0x00000000004d456e in PyGILState_Release ()
> #2 0x00007fffed1969b6 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #3 0x00007fffecd45693 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #4 0x00007fffecd45a03 in pa_pdispatch_run () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #5 0x00007fffed18cbdd in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #6 0x00007fffecd4a2a9 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #7 0x00007fffed19fa1e in pa_mainloop_dispatch () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #8 0x00007fffed19fde5 in pa_mainloop_iterate () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #9 0x00007fffed19fe90 in pa_mainloop_run () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #10 0x00007fffed1ae30f in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulse.so.0
> #11 0x00007fffecd57d18 in ?? () from
> /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
> #12 0x00007ffff7bc4e9a in start_thread (arg=0x7fffebb3f700) at
> pthread_create.c:308
> #13 0x00007ffff69b3cbd in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
> #14 0x0000000000000000 in ?? ()
>
> However, the console.py (non-gtk & no g_main_loop) testcase worked
> happily without segfault!
>
> The source code and testcase host on github
> https://github.com/xiangzhai/pypulseaudio please someone give me
> advice, thanks a lot!
>
> Xiang Zhai
Fixed https://bugs.freedesktop.org/show_bug.cgi?id=61328
I will give my sincere thanks to Tanu Kaskinen :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20130223/64bdab1c/attachment.html>
More information about the pulseaudio-discuss
mailing list