pbx: deadlock when outgoing dialed channel hangs up too quickly
Here's the basic scenario that occurred when executing an AMI fast originate while at the same time something else locks the channels container, and also wants a lock on the dialed channel: 1. pbx_outgoing_attempt obtains a lock on a dialed channel 2. concurrently another thread obtains a lock on the channels container, and subsequently requests a lock on the dialed channel. It waits on #1. For instance, "core show channel <dialed channel" 3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt function exits 4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and attempts to hang up the dialed channel 5. hang up tries to obtain the channels container lock, but can't due to #2. 6. Asterisk is deadlocked. The solution was to allow the pbx_outgoing_exec function to "steal" ownership of the dialed channel, and handle hanging it up. The channel now is either hung up prior to it being potentially locked by the initiating thread, or if locked the hang up takes place in a different thread, thus alleviating the deadlock. ASTERISK-28561 patches: iliketrains.diff submitted by Joshua Colp (license 5000) Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a
Loading
Please register or sign in to comment