diff options
author | Mark Michelson <mmichelson@digium.com> | 2016-03-10 16:58:49 -0600 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2016-03-24 16:59:24 -0500 |
commit | 89e94e886c8d2a3bf31eae50d838afc2c26906f9 (patch) | |
tree | cad5c660e96b3cfb620acf6d9c2485023f52044c /main/manager.c | |
parent | 894071ea2cedcc65e452cabfe3cd805daf5a6a1d (diff) |
Restrict CLI/AMI commands on shutdown.
During stress testing, we have frequently seen crashes occur because a
CLI or AMI command attempts to access information that is in the process
of being destroyed.
When addressing how to fix this issue, we initially considered fixing
individual crashes we observed. However, the changes required to fix
those problems would introduce considerable overhead to the nominal
case. This is not reasonable in order to prevent a crash from occurring
while Asterisk is already shutting down.
Instead, this change makes it so AMI and CLI commands cannot be executed
if Asterisk is being shut down. For AMI, this is absolute. For CLI,
though, certain commands can be registered so that they may be run
during Asterisk shutdown.
ASTERISK-25825 #close
Change-Id: I8887e215ac352fadf7f4c1e082da9089b1421990
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/manager.c b/main/manager.c index 2adcb3e5a..e74b253ff 100644 --- a/main/manager.c +++ b/main/manager.c @@ -6138,6 +6138,14 @@ static int process_message(struct mansession *s, const struct message *m) return 0; } + if (ast_shutting_down()) { + ast_log(LOG_ERROR, "Unable to process manager action '%s'. Asterisk is shutting down.\n", action); + mansession_lock(s); + astman_send_error(s, m, "Asterisk is shutting down"); + mansession_unlock(s); + return 0; + } + if (!s->session->authenticated && strcasecmp(action, "Login") && strcasecmp(action, "Logoff") |