pjproject icon indicating copy to clipboard operation
pjproject copied to clipboard

Answer incoming call, deadlock? can not resume auto.

Open tjyuanxi opened this issue 3 years ago • 1 comments

Describe the bug

We have a low probability problem today. After the incoming call is connected, the software deadlocks and cannot be recovered automatically. You need to turn off the software and turn it on again.

Steps to reproduce

Sorry, the recurrence probability is very low. I don't know how to reproduce it

PJSIP version

2.10

Context

window10.

Log, call stack, etc

17:15:21.958 pjsua2_ddapi.c  ........onCallState.id:0, state:2, role:1, remote_info:"18309086" <sip:[email protected]>, remote_contact:<sip:[email protected]:5180>, 194
17:15:21.958   pjsua_call.c  ..Answering call 0: code=180
17:15:21.958   pjsua_core.c  ......TX 642 bytes Response msg 180/INVITE/cseq=46997266 (tdta000001536D6BAE18) to UDP 10.48.150.20:5060:
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.48.150.20:5060;received=10.48.150.20;branch=z9hG4bK9e0e.b761eb83.0
Via: SIP/2.0/UDP 10.48.150.21:5180;rport=5180;received=10.48.150.21;branch=z9hG4bKt0p7g4e0e0HcK
Record-Route: <sip:10.48.150.20;lr;nat=yes;did=93c.29548c11>
Call-ID: 26885e1e-f862-123a-51bd-e4434b7c4cdc
From: "18309086" <sip:[email protected]>;tag=a3p3S877mpa9B
To: <sip:[email protected]>;tag=b603816153ab4443ae0343130b32c380
CSeq: 46997266 INVITE
Contact: <sip:[email protected]:5060;ob>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length:  0


--end msg--
17:15:21.958 pjsua2_ddapi.c  .........onCallState.id:0, state:3, role:1, remote_info:"18309086" <sip:[email protected]>, remote_contact:<sip:[email protected]:5180>, 194
17:15:26.849   pjsua_call.c !Answering call 0: code=200
17:15:26.849 inv000001536B4  ..SDP negotiation done: Success
17:15:26.849  pjsua_media.c  ...Call 0: updating media..
17:15:26.849  pjsua_media.c  .....Media stream call00:0 is destroyed
17:15:26.849    pjsua_aud.c  ....Audio channel update..
17:15:26.849 strm000001536A  .....VAD temporarily disabled
17:15:26.849 strm000001536A  .....Encoder stream started
17:15:26.849 strm000001536A  .....Decoder stream started
17:15:26.849  pjsua_media.c  ....Audio updated, stream #0: G729 (sendrecv)
17:15:26.850  pjsua_media.c  .....Media stream call00:1 is destroyed
17:15:26.850    pjsua_vid.c  ....Video channel update..
17:15:26.854 vstenc00000153  .....Encoder stream started
17:15:26.854 vstdec00000153  .....Decoder stream started
17:15:26.854    pjsua_vid.c  .....Setting up RX..
17:15:26.854    pjsua_vid.c  ......Creating video window: type=stream, cap_id=-1, rend_id=0
17:15:26.854     vid_port.c  .......Opening device SDL renderer [SDL] for render: format=I420, size=656x656 @22:1 fps
17:15:26.854      sdl_dev.c !SDL_CreateWindowFrom:00000153621E25E0, 0000000000000000, 0000000000000000, 737
17:15:26.906     vid_port.c !.......Device SDL renderer [SDL] opened: format=I420, size=656x656 @22:1 fps
17:15:26.907     vid_conf.c  .......Added port 0 (SDL renderer)
17:15:26.907    pjsua_vid.c  .......stream window id 0 created for cap_dev=-1 rend_dev=0
17:15:26.907    pjsua_vid.c  .......Window 0 created
17:15:26.907     vid_conf.c  ......Added port 1 (vstdec000001536ADC4CB8)
17:15:26.907     vid_conf.c  ......Port 1 (vstdec000001536ADC4CB8) transmitting to port 0 (SDL renderer)
17:15:26.907      sdl_dev.c  ......Starting sdl video stream
17:15:26.907    pjsua_vid.c  .....Setting up TX..
17:15:26.907     vid_conf.c  ......Added port 2 (vstenc000001536ADC4CB8)
17:15:26.907    pjsua_vid.c  ......Creating video window: type=preview, cap_id=1, rend_id=0
17:15:26.907     vid_port.c  .......Opening device Colorbar generator [Colorbar] for capture: format=I420, size=640x480 @15:1 fps
17:15:26.907     vid_port.c  .......Device Colorbar generator [Colorbar] opened: format=I420, size=352x288 @15:1 fps
17:15:26.908     vid_conf.c  .......Added port 3 (Colorbar generator)
17:15:26.908     vid_port.c  .......Opening device SDL renderer [SDL] for render: format=I420, size=640x480 @15:1 fps
17:15:26.908      sdl_dev.c !SDL_CreateWindowFrom:00000153621E45D8, 0000000000000000, 0000000000000000, 737
17:15:26.955     vid_port.c !.......Device SDL renderer [SDL] opened: format=I420, size=640x480 @15:1 fps
17:15:26.955     vid_conf.c  .......Added port 4 (SDL renderer)
17:15:26.955    pjsua_vid.c  .......preview window id 1 created for cap_dev=1 rend_dev=0
17:15:26.955    pjsua_vid.c  .......Window 1 created
17:15:26.955     vid_conf.c  ......Port 3 (Colorbar generator) transmitting to port 2 (vstenc000001536ADC4CB8)
17:15:26.955 colorbar_dev.c  ......Starting cbar video stream
17:15:26.955    pjsua_vid.c  .....auto_out_stream:0
17:15:26.955  pjsua_media.c  ....Video updated, stream #1: H264 (sendrecv)
17:15:26.955 pjsua2_ddapi.c  ...onCallMediaState.id:0, role:1, remote_info:"18309086" <sip:[email protected]>, remote_contact:<sip:[email protected]:5180>
17:15:26.955 pjsua2_ddapi.c  ...ci.media[0].type:1, status:1
17:15:26.955    pjsua_aud.c  ...Conf connect: 1 --> 0
17:15:26.955    pjsua_aud.c  ....Set sound device: capture=-1, playback=-2
17:15:26.955    pjsua_aud.c  .....Opening sound device (speaker + mic) PCM@16000/1/20ms
17:15:26.961     wmme_dev.c  ...... WaveAPI Sound player "Wave mapper" initialized (format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320 (20ms))
17:15:28.924     wmme_dev.c  ...... WaveAPI Sound recorder "Wave mapper" initialized (format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320 (20ms))
17:15:28.924 ec000001536AE5  ......Speex AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=0 ms
17:15:28.924     wmme_dev.c  ......WMME playback stream started
17:15:28.924     wmme_dev.c  ......WMME capture stream started
17:15:28.926   conference.c  ....Port 1 (sip:[email protected]) transmitting to port 0 (Wave mapper)
17:15:28.926 pjsua2_ddapi.c  ...rx_level:2.000000, tx_level:2.000000, 252
17:15:28.926    pjsua_aud.c  ...Conf connect: 0 --> 1
17:15:28.926   conference.c  ....Port 0 (Wave mapper) transmitting to port 1 (sip:[email protected])
17:15:28.926 pjsua2_ddapi.c  ...pjcall_get_remote_acc_info.str_acct:18309086, n_port:5180, str_ip:10.48.150.21, remoteUri:"18309086" <sip:[email protected]>, remoteContact:<sip:[email protected]:5180>, 264
17:15:28.926 pjsua2_ddapi.c  ...ci.media[1].type:2, status:1
17:15:28.926 pjsua2_ddapi.c  ...pjcall_get_remote_acc_info.str_acct:18309086, nCapDev:-1, n_port:5180, str_ip:10.48.150.21, remoteUri:"18309086" <sip:[email protected]>, remoteContact:<sip:[email protected]:5180>, windid:0, 273
17:15:29.023   pjsua_call.c !.Timed-out trying to acquire dialog mutex (possibly system has deadlocked) in reinv_timer_cb()
17:15:29.034   pjsua_core.c  .TX 499 bytes Request msg REGISTER/cseq=20670 (tdta000001536ABD3D58) to UDP 10.48.150.20:5060:
REGISTER sip:10.48.150.20 SIP/2.0
Via: SIP/2.0/UDP 10.49.44.242:5060;rport;branch=z9hG4bKPj4df98ed719494ac2846d249f4a0ba4b1
Max-Forwards: 70
From: <sip:[email protected]>;tag=d5679925235c444b92d6e11e2ce0a289
To: <sip:[email protected]>
Call-ID: 5585fd2ae2f34a50b05e930ae00aafad
CSeq: 20670 REGISTER
Contact: <sip:[email protected]:5060;ob>
Expires: 10
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length:  0


--end msg--
17:15:29.035   pjsua_core.c  .RX 490 bytes Response msg 401/REGISTER/cseq=20670 (rdata000001536B96BE28) from UDP 10.48.150.20:5060:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.49.44.242:5060;received=10.49.44.242;rport=5060;branch=z9hG4bKPj4df98ed719494ac2846d249f4a0ba4b1
From: <sip:[email protected]>;tag=d5679925235c444b92d6e11e2ce0a289
To: <sip:[email protected]>;tag=6380f18c3c06122cd4e7c18a7f6e8f31.c979
Call-ID: 5585fd2ae2f34a50b05e930ae00aafad
CSeq: 20670 REGISTER
WWW-Authenticate: Digest realm="10.48.150.20", nonce="61efc6b2c72dfe01213e34edcb64f948830e8a76", qop="auth"
Content-Length: 0


--end msg--
17:15:29.035   pjsua_core.c  ....TX 751 bytes Request msg REGISTER/cseq=20671 (tdta000001536ABD3D58) to UDP 10.48.150.20:5060:
REGISTER sip:10.48.150.20 SIP/2.0
Via: SIP/2.0/UDP 10.49.44.242:5060;rport;branch=z9hG4bKPj43e20862a9304b3f9847fefca319b749
Max-Forwards: 70
From: <sip:[email protected]>;tag=d5679925235c444b92d6e11e2ce0a289
To: <sip:[email protected]>
Call-ID: 5585fd2ae2f34a50b05e930ae00aafad
CSeq: 20671 REGISTER
Contact: <sip:[email protected]:5060;ob>
Expires: 10
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="xw64818186", realm="10.48.150.20", nonce="61efc6b2c72dfe01213e34edcb64f948830e8a76", uri="sip:10.48.150.20", response="430fa97f96a01cbb8b7cb60542e98093", cnonce="82f0c2f686a94f39a5aa744a3b173d22", qop=auth, nc=00000001
Content-Length:  0


--end msg--
17:15:29.038   pjsua_core.c  .RX 463 bytes Response msg 200/REGISTER/cseq=20671 (rdata000001536C2C4E78) from UDP 10.48.150.20:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.49.44.242:5060;received=10.49.44.242;rport=5060;branch=z9hG4bKPj43e20862a9304b3f9847fefca319b749
From: <sip:[email protected]>;tag=d5679925235c444b92d6e11e2ce0a289
To: <sip:[email protected]>;tag=6380f18c3c06122cd4e7c18a7f6e8f31.b61a
Call-ID: 5585fd2ae2f34a50b05e930ae00aafad
CSeq: 20671 REGISTER
Contact: <sip:[email protected]:5060;ob>;expires=60;received="sip:10.49.44.242:5060"
Content-Length: 0


--end msg--
17:15:29.038    pjsua_acc.c  ....SIP outbound status for acc 0 is not active
17:15:29.038    pjsua_acc.c  ....sip:[email protected]: registration success, status=200 (OK), will re-register in 60 seconds
17:15:29.038    pjsua_acc.c  ....Keep-alive timer started for acc 0, destination:10.48.150.20:5060, interval:15s
17:15:29.038 pjsua2_ddapi.c  ....onRegState:200, 0, OK, 303
17:15:29.585 strm000001536A !VAD re-enabled
17:15:33.964   sound_port.c  EC suspended because of inactivity

tjyuanxi avatar Jan 25 '22 14:01 tjyuanxi

I have also encountered this problem, high concurrency (400+) when the probability will be encountered.

Timed-out trying to acquire PJSUA mutex (possibly system has deadlocked) in reinv_timer_cb()

Timed-out trying to acquire PJSUA mutex (possibly system has deadlocked) in pjsua_call_hangup()

Timed-out trying to acquire PJSUA mutex (possibly system has deadlocked) in pjsua_call_answer()

PJSIP version 2.10

My application only calls the pjsua_call_answer() and pjsua_call_hangup() methods.

I'm going to try to update to the latest version.

lx32056127 avatar Jun 23 '22 03:06 lx32056127

Yes, let us know if the issue still persists with the latest version.

Since you're using video, we recommend to call PJSIP API from a separate thread other than the GUI/main thread to avoid deadlock.

sauwming avatar Feb 02 '23 03:02 sauwming