[Asterisk-code-review] cli: Prevent assertions on startup from bad ao2 refs. (asterisk[master])

N A asteriskteam at digium.com
Tue May 3 08:12:15 CDT 2022


Attention is currently required from: Joshua Colp.
N A has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18523 )

Change subject: cli: Prevent assertions on startup from bad ao2 refs.
......................................................................


Patch Set 1:

(1 comment)

File main/cli.c:

https://gerrit.asterisk.org/c/asterisk/+/18523/comment/4868ef5f_c09bf97c 
PS1, Line 1143: 	while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
> What is not fully initialized?

Joshua C. Colp added a comment - 22/Jan/22 4:55 PM
In fact, looking at the implementation of ao2_iterator_init that is precisely the cause. The channel cache by name is not yet initialized/allocated when you're invoking the CLI command, causing ao2_iterator_init to FRACK when calling ao2_t_ref and producing the records.

So accessing the channel cache is dangerous at this point, so that's why we wait for startup to finish before doing so.

> Should we or can we initialize it sooner?

I would think this would require all channel drivers to register first. There seems to be an order to startup with channel drivers intentionally pushed down the list a bit for dependencies to load. Moving it up could break other things.

> How soon can remote consoles connect?

Pretty much immediately. This is intentional so if something goes wrong during startup, it can be seen. e.g. the entire point of asterisk -R, and with asterisk -c the console is also there immediately.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18523
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If6b3cde802876bd738c1b4cf2683bea6ddc615b6
Gerrit-Change-Number: 18523
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-CC: Friendly Automation
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Tue, 03 May 2022 13:12:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220503/c1ff8fed/attachment-0001.html>


More information about the asterisk-code-review mailing list