[Home]

Summary:ASTERISK-18031: Deadlock in ast_async_goto() because of wrong locking order
Reporter:Kirill Katsnelson (kkm)Labels:
Date Opened:2011-06-17 05:21:19Date Closed:2011-06-22 15:39:09
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/PBX
Versions:1.8.4 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:Attachments:( 0) 018031-kkm-async-goto-deadlock.diff
Description:Asterisk 1.8.4.2 under call load locked up multiple times upon provessing SIP REFER message in {{ast_async_goto()}}.

The reason is that {{ast_async_goto()}} tries to acquire locks in the wrong order: it calls {{ast_channel_lock()}} early, then {{ast_channel_alloc()}}, which in turn locks the channels container to insert the new channel. This deadlocks with other threads that already hold the channels container lock and attempting to lock this channel, in all cases by way of {{find_channel_...()}}.
Comments:By: Kirill Katsnelson (kkm) 2011-06-17 22:08:51.291-0500

dvossel posted a better fix on the review board: https://reviewboard.asterisk.org/r/1275/diff/

By: David Vossel (dvossel) 2011-06-21 17:54:15.320-0500

This has been committed.

By: Kirill Katsnelson (kkm) 2011-06-21 18:11:50.237-0500

Thanks!