[asterisk-bugs] [JIRA] (ASTERISK-30039) cli: Targeted debug on startup deadlocks and creates unstable system

N A (JIRA) noreply at issues.asterisk.org
Tue May 3 07:39:40 CDT 2022


    [ https://issues.asterisk.org/jira/browse/ASTERISK-30039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259074#comment-259074 ] 

N A edited comment on ASTERISK-30039 at 5/3/22 7:39 AM:
--------------------------------------------------------

Indeed, it still seems to deadlock when I have it sleep in ast_module_helper.

Looking at the backtrace though, ast_module_helper is only called in that one place, and doesn't appear anywhere else. Instead of holding the lock, it's just sleeping.

I think this is problematic because as long as the CLI is sleeping, then it's holding the CLI lock, and when the main thread tries to register the CLI, then it's waiting on the CLI lock. So even without trying to grab a lock on the module lock, the effect is the same in that we get deadlock.

It would seem to me the only feasible thing to do is simply immediately return NULL, e.g. just fail any tab completes before startup is complete. Would this be acceptable?

(I've confirmed this works with no ill effects. User will just need to retry once Asterisk is ready).


was (Author: interlinked):
Indeed, it still seems to deadlock when I have it sleep in ast_module_helper.

Looking at the backtrace though, ast_module_helper is only called in that one place, and doesn't appear anywhere else. Instead of holding the lock, it's just sleeping.

I think this is problematic because as long as the CLI is sleeping, then it's holding the CLI lock, and when the main thread tries to register the CLI, then it's waiting on the CLI lock. So even without trying to grab a lock on the module lock, the effect is the same in that we get deadlock.

It would seem to me the only feasible thing to do is simply immediately return NULL, e.g. just fail any tab completes before startup is complete. Would this be acceptable?

> cli: Targeted debug on startup deadlocks and creates unstable system
> --------------------------------------------------------------------
>
>                 Key: ASTERISK-30039
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30039
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Logging
>    Affects Versions: 18.9.0
>            Reporter: N A
>            Assignee: Unassigned
>         Attachments: full.txt
>
>
> If, while Asterisk is starting, you attempt to use tab completion with "core set debug X <tab complete>", and you do this BEFORE Asterisk is fully ready, the CLI will deadlock and the system will become permanently unstable and fail to ever initialize. Not all commands do this but "core set debug X <tab complete>" does do it. Seems to be an "unsafe" operation if Asterisk is not ready for some reason.
> e.g. if you use SIGQUIT to exit the CLI and then go back into a remote console, if you run "core restart now" it will say no command found because the system never fully started so Asterisk is still not (and will never be) ready.
> Even ast_coredumper fails because it fails to get the PID and there isn't an option to manually specify it.
> This does reproduce consistently.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list