[Asterisk-code-review] pbx: Deadlock between contexts container and context merge l... (asterisk[11])

Matt Jordan asteriskteam at digium.com
Mon Dec 28 09:19:28 CST 2015


Matt Jordan has posted comments on this change.

Change subject: pbx: Deadlock between contexts container and context_merge locks
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/1855/1/main/pbx.c
File main/pbx.c:

Line 6027: 	ast_mutex_lock(&state_callbacks_lock);
I don't think this is the right solution here, for two reasons:

(1) The state_callbacks_lock added here appears nearly identical in purpose to simply locking the entire hints container, something that is done in this routine. If nothing else, it merely reels redundant with that existing barrier.

(2) If the race condition is that a single hint's state may be changed by both the device state callback and ast_change_hint, then the hint needs to be protected - not the entire container for the lifetime of that change. I think this code and the previous code should be modified to hold onto the lock of the hint until the state is extracted off of it and passed to the callback function in execute_state_callback. That should fix the race condition, while at the same time not introduce yet another global mutex into this code.


-- 
To view, visit https://gerrit.asterisk.org/1855
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7f67ce4b4c94b731c23932cc2ba9e0a4a720813d
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list