]> git.ipfire.org Git - thirdparty/asterisk.git/commit
app_dial.c: Moved channel lock to prevent deadlock
authorAlexey Khabulyak <khabalex@gmail.com>
Mon, 4 Aug 2025 14:48:57 +0000 (17:48 +0300)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 17 Sep 2025 17:40:38 +0000 (11:40 -0600)
commit206ae3a0988dcb80a810cd3f78275e3977b15d4d
tree69a35b2a37e042044db8b2ab1b87461bc8ad0fe2
parent671615f2cfc18d24b8f4f6ab023a672bb647c4ec
app_dial.c: Moved channel lock to prevent deadlock

It's reproducible with pbx_lua, not regular dialplan.

deadlock description:
1. asterisk locks a channel
2. calls function onedigit_goto
3. calls ast_goto_if_exists funciton
4. checks ast_exists_extension -> pbx_extension_helper
5. pbx_extension_helper calls pbx_find_extension
6. Then asterisk starts autoservice in a new thread
7. autoservice run tries to lock the channel again

Because our channel is locked already, autoservice can't lock.
Autoservice can't lock -> autoservice stop is waiting forever.
onedigit_goto waits for autoservice stop.

Resolves: https://github.com/asterisk/asterisk/issues/1335
(cherry picked from commit 09a3c8df7024043bcf37843176933250f572dd8f)
apps/app_dial.c