[asterisk-dev] [Code Review] Fix a deadlock in agents occuring due to trying to lock a channel while having a lock on the pvt.

Mark Michelson reviewboard at asterisk.org
Fri Feb 3 12:35:25 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1708/#review5404
-----------------------------------------------------------



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9972>

    You also need to unlock owner in this if block.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9973>

    You should copy p->moh into a local buffer while you have p locked.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9974>

    No need to initialize to NULL here.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9975>

    Again, no need to initialize to NULL.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9976>

    This should be "owner = agent_lock_all(p);"



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9977>

    Use "owner" here instead of "p->owner"



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9978>

    Another unnecessary initialization to NULL.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9979>

    This should be "owner = agent_lock_all(p);"



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9980>

    Unnecessary initialization.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9981>

    Use "owner = agent_lock_all(p);"



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9982>

    Use "owner" instead of "p->owner" here.



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9983>

    I think you know what I'm going to say by now...



/branches/1.8/channels/chan_agent.c
<https://reviewboard.asterisk.org/r/1708/#comment9984>

    And here too...


- Mark


On Feb. 3, 2012, 11:52 a.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1708/
> -----------------------------------------------------------
> 
> (Updated Feb. 3, 2012, 11:52 a.m.)
> 
> 
> Review request for Asterisk Developers, Mark Michelson, rmudgett, and Matt Jordan.
> 
> 
> Summary
> -------
> 
> Also adds locking to a number of other functions which are calling ast_bridged_channel (which is documented as requiring a lock for safe running, which was the purpose of irroot's original locking patch in action_agents.
> 
> Unlike the other patch on reviewboard right now, this opts to enforce locking order instead of using deadlock avoidance.
> 
> Celebrity endorsement: "This looks incredibly sane to me." - MMichelson
> 
> 
> This addresses bug ASTERISK-19285.
>     https://issues.asterisk.org/jira/browse/ASTERISK-19285
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_agent.c 353685 
> 
> Diff: https://reviewboard.asterisk.org/r/1708/diff
> 
> 
> Testing
> -------
> 
> Not much I'm afraid to say. I can't reproduce the issue since it involves real world use over a period of time.  I'll ask Alex Villacís Lasso to give it a shot though.
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120203/ab100ab7/attachment-0001.htm>


More information about the asterisk-dev mailing list