[Asterisk-code-review] Fix deadlock handling subscribe req during res parking reload (asterisk[13])

Giuseppe Sucameli asteriskteam at digium.com
Wed Nov 28 02:25:02 CST 2018


Giuseppe Sucameli has posted comments on this change. ( https://gerrit.asterisk.org/10701 )

Change subject: Fix deadlock handling subscribe req during res_parking reload
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.asterisk.org/#/c/10701/2/main/pbx.c
File main/pbx.c:

https://gerrit.asterisk.org/#/c/10701/2/main/pbx.c@3316
PS2, Line 3316: 		/* The extension has already been destroyed,
              : 		 * notify extension deactivation
              : 		 */
> Is it now possible at all for this to be invoked multiple times?
Nice shot! 

AFAICT it may happen since the device_state_notify_callbacks function is called from both handle_hint_change_message_type() (via stasis) and device_state_cb().

We may add a check for hint->laststate value and return if it is equal to AST_EXTENSION_DEACTIVATED. This guarantees it's executed once because hint is locked and hint->laststate is changed few lines below


https://gerrit.asterisk.org/#/c/10701/2/main/pbx.c@3989
PS2, Line 3989: 	if (!(message = stasis_message_create(hint_change_message_type(), hint))) {
> Why the removal of the second reference and comment? Was there a leak previously?
Yes, there was a leak.

The stasis_message_create function calls stasis_message_create_full() that bumps hint ref once.

Then the new message is passed to statis_publish function that bumps message ref (within dispatch_message()), so bumping hint ref two times because of message being published to two topics is wrong and it causes mem leak.



-- 
To view, visit https://gerrit.asterisk.org/10701
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I5b03c3455b3b12b6f83cea4cc34f4b4b20444f7e
Gerrit-Change-Number: 10701
Gerrit-PatchSet: 2
Gerrit-Owner: Giuseppe Sucameli <sucameli at netresults.it>
Gerrit-Reviewer: Giuseppe Sucameli <sucameli at netresults.it>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Comment-Date: Wed, 28 Nov 2018 08:25:02 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181128/b2de5db0/attachment.html>


More information about the asterisk-code-review mailing list