Opened 5 years ago

Closed 5 years ago

#2182 closed defect (fixed)

Prevent crash in unpublishing presence when deleting account

Reported by: ming Owned by: ming
Priority: normal Milestone: release-2.9
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no


  1. In pjsua_acc_del(), it calls pjsua_acc_set_registration(acc_id, PJ_FALSE), which calls pjsua_pres_unpublish(&pjsua_var.acc[acc_id], 0);
  2. And then, it will call pjsua_pres_delete_acc() which also calls pjsua_pres_unpublish(acc, flags);
  3. It's possible that publish_cb() in (1) is called at the same time as (2) and the callback is in the process of destroying the publish session, hence resulting in a crash.

Change History (1)

comment:1 Changed 5 years ago by ming

  • Owner set to ming
  • Resolution set to fixed
  • Status changed from new to closed

In 5949:

Fixed #2182: Prevent crash in unpublishing presence when deleting account

Note that this fix only covers the account deletion scenario. It doesn't prevent the race condition between deleting account in publish_cb and accessing the publish session itself, which should be solved using a locking mechanism.

Thanks to Bogdan Bogdan Chifor for the report.

Note: See TracTickets for help on using tickets.