[Home]

Summary:ASTERISK-28636: app_chanisavail+cdr: ChanIsAvail sometimes fails to deactivate CDR.
Reporter:Frederic LE FOLL (flefoll)Labels:
Date Opened:2019-11-27 11:12:17.000-0600Date Closed:2019-12-19 10:53:57.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_chanisavail CDR/General
Versions:16.6.0 Frequency of
Occurrence
Occasional
Related
Issues:
Environment:Attachments:
Description:ChanIsAvail application calls ast_cdr_set_property() in in order to set AST_CDR_FLAG_DISABLE_ALL on temporary channel used to test outgoing resource (ASTERISK-28527).

Despite this CDR deactivation request, CDR are sometimes generated for the temporary channel.
The problem is visible in endurance tests, even under moderate call load, and it affects approx. 1% of calls.
Comments:By: Asterisk Team (asteriskteam) 2019-11-27 11:12:19.025-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Frederic LE FOLL (flefoll) 2019-11-27 11:20:54.551-0600

Analysis:

ChanIsAvail creates a temporary Channel in order to check outgoing resource availability and hangs up immediately. Temporary channel lifespan is extremely short.

cdr.c:ast_cdr_set_property(), called before ast_hangup(), will fail if it does not find CDR structure in active_cdrs_master container.

The problem here is:
1) CDR insertion into active_cdrs_master container depends on a Stasis message processing (message triggered by channel creation): it occurs upon a call to cdr.c:handle_channel_cache_message(), when processing a Stasis message of type ast_channel_snapshot_type(): this is processed by a dedicated thread that executes handle_channel_cache_message().
2) AST_CDR_FLAG_DISABLE_ALL flag activation uses the straight path, with a direct function call from app_chanisavail.c:chanavail_exec() to cdr.c:ast_cdr_set_property(), and it may be processed before CDR is present in active_cdrs_master container.

Conclusion: we have two different pathes for two different actions, with second path being faster that first path.

Proposal :

Is there any possibility to serialize both operations (1 - CDR insertion in CDR list, 2 - flag activation) ?
If not, I see no better solution that implement a retry. But since this would come with a performance cost, probably CDR deactivation should become an option ("n" for "no cdr" ?).

By: Friendly Automation (friendly-automation) 2019-12-19 10:53:58.374-0600

Change 13472 merged by Friendly Automation:
app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.

[https://gerrit.asterisk.org/c/asterisk/+/13472|https://gerrit.asterisk.org/c/asterisk/+/13472]

By: Friendly Automation (friendly-automation) 2019-12-19 18:43:13.261-0600

Change 13470 merged by Joshua C. Colp:
app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.

[https://gerrit.asterisk.org/c/asterisk/+/13470|https://gerrit.asterisk.org/c/asterisk/+/13470]

By: Friendly Automation (friendly-automation) 2019-12-19 18:43:32.381-0600

Change 13471 merged by Joshua C. Colp:
app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.

[https://gerrit.asterisk.org/c/asterisk/+/13471|https://gerrit.asterisk.org/c/asterisk/+/13471]

By: Friendly Automation (friendly-automation) 2019-12-19 18:43:52.288-0600

Change 13310 merged by Joshua C. Colp:
app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.

[https://gerrit.asterisk.org/c/asterisk/+/13310|https://gerrit.asterisk.org/c/asterisk/+/13310]