]> 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 20:04:27 +0000 (14:04 -0600)
commita600e881bea2a246d6b8f40d389fefc984b77241
treeae3d2024d47ad85ff1436c57ff2ac0a1c77b233a
parenta27c07bcc098ffc912b4c7dbb5d941c438f92058
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 4b766d24d078dff701805f18cb41fb59bd6033ce)
apps/app_dial.c