Crash in Python PJSUA2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

merging the discussion with "Threading in Python PJSUA2".

The workaround is to use

for i in range(0, len(info.media)):
	mi = info.media[i]

instead of

for mi in info.media:

Making the Python wrapper with -threads is very handy otherwise. Without 
it, writing a simple console application that does some initialization 
and then reacts on events until Enter is pressed (by 
sys.stdin.readline()) is possible only by making all PJ calls (including 
libCreate and polling) from an extra thread. You cannot use just a 
thread for libRegisterWorkerThread(), it blocks console I/O somehow.

Best regards,
    Vali


PS. Often I have problems posting to the list -- is there an interval I 
have to wait between posts?

Reporting-MTA: dns; gmmr7.centrum.cz
X-Postfix-Queue-ID: 8EA358039ACC
X-Postfix-Sender: rfc822; vali at kamarad.cz
Arrival-Date: Sun,  9 Mar 2014 16:40:05 +0100 (CET)

Final-Recipient: rfc822; pjsip at lists.pjsip.org
Original-Recipient: rfc822;pjsip at lists.pjsip.org
Action: failed
Status: 4.4.2
Diagnostic-Code: X-Postfix; conversation with 
lists.pjsip.org[192.151.138.19] timed out while sending RCPT TO


Dne 11.3.2014 9:54, Benny Prijono napsal(a):
> Hi,
>
> I could reproduce this by adding -threads to swig as you suggested. What
> is the workaround again?
>
> Best regards,
>   Benny
>
>
> On Fri, Mar 7, 2014 at 8:18 PM, Tom?? Valenta <vali at kamarad.cz
> <mailto:vali at kamarad.cz>> wrote:
>
>     Hi Ming,
>
>     thanks for answer. I guess it is either a bug in SWIG or there is a
>     collision between C/C++ memory allocation and that from a memory pool.
>
>     Anyway the workaround recorded below.
>
>     Cheers,
>     - Vali
>
>
>     Dne 7.3.2014 2:41, Ming napsal(a):
>
>         Hi Tomas,
>
>         In our pygui pjsua2 python sample app, we also iterate media
>         using the
>         same method and it runs fine (it's in call.py onCallMediaState()).
>
>         Regards,
>         Ming
>
>
>         On Thu, Mar 6, 2014 at 7:59 PM, Tom?? Valenta <Vali at kamarad.cz
>         <mailto:Vali at kamarad.cz>
>         <mailto:Vali at kamarad.cz <mailto:Vali at kamarad.cz>>> wrote:
>
>              Hi,
>
>              I found a strange crash in Python PJSUA2 when iterating
>         call info
>              medias. See the patch pjproject-fdport.patch, file
>              pjproject/pjsip_apps/src/swig/__python/audio_fd.py. If you
>         replace
>              for i in range(...)
>              with
>              for mi in info.media
>              as in the comment, you get the crash:
>
>              Program received signal SIGSEGV, Segmentation fault.
>              [Switching to Thread 0x7ffff47e8700 (LWP 24109)]
>              0x0000000000501bb8 in ?? ()
>              (gdb) bt
>              #0  0x0000000000501bb8 in ?? ()
>              #1  0x0000000000501fae in ?? ()
>              #2  0x00007ffff5ce7b95 in ~SwigPtr_PyObject
>         (this=0x7fffec01ce38,
>                    __in_chrg=<optimized out>) at pjsua2_wrap.cpp:3697
>              #3  ~SwigPtr_PyObject (this=0x7fffec01ce38,
>         __in_chrg=<optimized out>)
>                    at pjsua2_wrap.cpp:4745
>              #4  ~SwigPyIterator (this=0x7fffec01ce30,
>         __in_chrg=<optimized out>)
>                    at pjsua2_wrap.cpp:4003
>              #5  ~SwigPyIterator_T (this=0x7fffec01ce30,
>         __in_chrg=<optimized out>)
>                    at pjsua2_wrap.cpp:4646
>              #6  ~SwigPyIteratorClosed_T (this=0x7fffec01ce30,
>              __in_chrg=<optimized out>)
>                    at pjsua2_wrap.cpp:4745
>              #7
>
>         swig::SwigPyIteratorClosed_T<____gnu_cxx::__normal_iterator<__pj::CallMediaInfo*,
>              std::vector<pj::CallMediaInfo,
>         std::allocator<pj::__CallMediaInfo> > >,
>              pj::CallMediaInfo, swig::from_oper<pj::__CallMediaInfo>
>                >::~SwigPyIteratorClosed_T (this=0x7fffec01ce30,
>                    __in_chrg=<optimized out>) at pjsua2_wrap.cpp:4745
>              #8  0x00007ffff5c3cb41 in _wrap_delete_SwigPyIterator
>              (args=<optimized out>)
>                    at pjsua2_wrap.cpp:8008
>              #9  0x00000000004d91b6 in PyObject_Call ()
>              #10 0x00000000004d9e1b in PyObject_CallFunctionObjArgs ()
>              #11 0x00007ffff5c04045 in SwigPyObject_dealloc
>         (v=0x7ffff544e2d0)
>                    at pjsua2_wrap.cpp:1698
>              #12 0x000000000042618d in ?? ()
>              #13 0x0000000000501dc8 in ?? ()
>              #14 0x000000000054d0a2 in PyEval_EvalFrameEx ()
>              #15 0x0000000000575d92 in PyEval_EvalCodeEx ()
>              #16 0x0000000000577ab0 in ?? ()
>              #17 0x00000000004d91b6 in PyObject_Call ()
>              #18 0x00000000004c91fa in ?? ()
>              #19 0x00000000004d91b6 in PyObject_Call ()
>              #20 0x000000000042e317 in PyObject_CallMethod ()
>              #21 0x00007ffff5c7766d in SwigDirector_Call::__onCallMediaState
>              (this=0x7fffec013cc0,
>                    prm=...) at pjsua2_wrap.cpp:7146
>              #22 0x00007ffff5d396d3 in
>              pj::Call::processMediaUpdate(__pj::OnCallMediaStateParam&) ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #23 0x00007ffff5d1d4ed in
>         pj::Endpoint::on_call_media___state(int) ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #24 0x00007ffff5d590ef in pjsua_call_on_media_update ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #25 0x00007ffff5d79ad4 in inv_negotiate_sdp ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #26 0x00007ffff5d7a2dd in process_answer ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #27 0x00007ffff5d7a789 in pjsip_inv_answer ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #28 0x00007ffff5d55bfe in pjsua_call_answer2 ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #29 0x00007ffff5d361d3 in
>         pj::Call::answer(pj::__CallOpParam const&) ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #30 0x00007ffff5c7cbbb in _wrap_Call_answer
>         (args=<optimized out>)
>                    at pjsua2_wrap.cpp:77213
>              #31 0x0000000000550138 in PyEval_EvalFrameEx ()
>              #32 0x0000000000575d92 in PyEval_EvalCodeEx ()
>              #33 0x000000000054c028 in PyEval_EvalFrameEx ()
>              #34 0x0000000000575d92 in PyEval_EvalCodeEx ()
>              #35 0x0000000000577ab0 in ?? ()
>              #36 0x00000000004d91b6 in PyObject_Call ()
>              #37 0x00000000004c91fa in ?? ()
>              #38 0x00000000004d91b6 in PyObject_Call ()
>              #39 0x000000000042e317 in PyObject_CallMethod ()
>              #40 0x00007ffff5c7860d in
>         SwigDirector_Account::__onIncomingCall
>              (this=0x9cde40, prm=...)
>                    at pjsua2_wrap.cpp:6806
>              #41 0x00007ffff5d1c721 in
>         pj::Endpoint::on_incoming___call(int, int,
>              pjsip_rx_data*) ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #42 0x00007ffff5d54357 in pjsua_call_on_incoming ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #43 0x00007ffff5d5c525 in mod_pjsua_on_rx_request ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #44 0x00007ffff5da257b in pjsip_endpt_process_rx_data ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #45 0x00007ffff5da28c0 in endpt_on_rx_msg ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #46 0x00007ffff5dab4cb in pjsip_tpmgr_receive_packet ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #47 0x00007ffff5dac33f in udp_on_read_complete ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #48 0x00007ffff5e78298 in ioqueue_dispatch_read_event ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #49 0x00007ffff5e7a39d in pj_ioqueue_poll ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #50 0x00007ffff5da224b in pjsip_endpt_handle_events2 ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #51 0x00007ffff5d5f177 in pjsua_handle_events ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #52 0x00007ffff5d5c798 in worker_thread ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #53 0x00007ffff5e7b41f in thread_main ()
>                   from
>         /home/tom/pjproject-2.2/pjsip-__apps/src/swig/python/_pjsua2.__so
>              #54 0x00007ffff7bc4e9a in start_thread () from
>              /lib/x86_64-linux-gnu/__libpthread.so.0
>              #55 0x00007ffff699e3fd in clone () from
>         /lib/x86_64-linux-gnu/libc.so.__6
>              #56 0x0000000000000000 in ?? ()
>
>              Ubuntu 12.04.4 precise x64
>              gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
>              Python 2.7.3
>              SWIG Version 2.0.4
>
>              Cheers,
>              - Vali
>
>              _________________________________________________
>              Visit our blog: http://blog.pjsip.org
>
>              pjsip mailing list
>         pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>         <mailto:pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>>
>         http://lists.pjsip.org/__mailman/listinfo/pjsip_lists.__pjsip.org <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
>
>
>
>
>
>         _________________________________________________
>         Visit our blog: http://blog.pjsip.org
>
>         pjsip mailing list
>         pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>         http://lists.pjsip.org/__mailman/listinfo/pjsip_lists.__pjsip.org <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
>
>
>
>     _________________________________________________
>     Visit our blog: http://blog.pjsip.org
>
>     pjsip mailing list
>     pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>     http://lists.pjsip.org/__mailman/listinfo/pjsip_lists.__pjsip.org
>     <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
>
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux