]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sla: Prevent deadlock and crash due to autoservicing.
authorNaveen Albert <asterisk@phreaknet.org>
Sat, 24 Sep 2022 10:15:09 +0000 (10:15 +0000)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 28 Nov 2022 14:54:30 +0000 (08:54 -0600)
commit2efa290d3c96cbcfa6095b1361863f7bc19b14a6
tree3b1419e524a700011323a18e258f758a45679e12
parentce2153fc5aa4e1b252d4d9d608748b6615460f30
sla: Prevent deadlock and crash due to autoservicing.

SLAStation currently autoservices the station channel before
creating a thread to actually dial the trunk. This leads
to duplicate servicing of the channel which causes assertions,
deadlocks, crashes, and moreover not the correct behavior.

Removing the autoservice prevents the crash, but if the station
hangs up before the trunk answers, the call hangs since the hangup
was never serviced on the channel.

This is fixed by not autoservicing the channel, but instead
servicing it in the thread dialing the trunk, since it is doing
so synchronously to begin with. Instead of sleeping for 100ms
in a loop, we simply use the channel for timing, and abort
if it disappears.

The same issue also occurs with SLATrunk when a call is answered,
because ast_answer invokes ast_waitfor_nandfds. Thus, we use
ast_raw_answer instead which does not cause any conflict and allows
the call to be answered normally without thread blocking issues.

ASTERISK-29998 #close

Change-Id: Icc237d50354b5910000d2305901e86d2c87bb9d8
apps/app_meetme.c