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

Assertion when sending SUBSCRIBE failed synchronously #3985

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nanangizz
Copy link
Member

Reported that assertion happens with this call stack trace:

Crashed: Thread: SIGABRT  0x0000000000000000
#00 pc 0x51894 libc.so (BuildId: 058e3ec96fa600fb840a6a6956c6b64e)
#01 pc 0x51864 libc.so (BuildId: 058e3ec96fa600fb840a6a6956c6b64e)
#02 pc 0x51c64 libc.so (BuildId: 058e3ec96fa600fb840a6a6956c6b64e)
#03 pc 0x661c08 libpjsua2.so (pjsip_dlg_dec_lock) (BuildId: 4922aaff88b25fc51d5455bb4471a2161724c7f0)
#04 pc 0x5ea78c libpjsua2.so (subscribe_buddy_presence) (BuildId: 4922aaff88b25fc51d5455bb4471a2161724c7f0)
#05 pc 0x5ea0b8 libpjsua2.so (pjsua_buddy_update_pres) (BuildId: 4922aaff88b25fc51d5455bb4471a2161724c7f0)

After investigating the provided log file, the problem seems to be accessing buddy states after getting reset/null-ed. Check subscribe_buddy() code here:

if (presence) {
status = pjsip_pres_send_request(buddy->sub, tdata);
} else {
status = pjsip_dlg_event_send_request(buddy->sub, tdata);
}
if (status != PJ_SUCCESS) {
pjsip_dlg_dec_lock(buddy->dlg);
pjsip_pres_terminate(buddy->sub, PJ_FALSE);

When the sending fails synchronously, the callbacks of transaction and event subscription may be invoked. From the callbacks, the event subscription terminates the subscription and PJSUA presence resets the buddy states. So when the send operation returns, the buddy states (e.g: buddy->dlg & buddy->sub) may have been set to NULL and pjsip_dlg_dec_lock(NULL) will raise an assertion.

* to be prepared for such scenario here.
*/
dlg = buddy->dlg;
sub = buddy->sub;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem to be used?

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

Successfully merging this pull request may close these issues.

None yet

3 participants