[Home]

Summary:ASTERISK-29040: res_speech: Assertion on format
Reporter:Nickolay V. Shmyrev (nshmyrev)Labels:patch
Date Opened:2020-08-21 16:39:18Date Closed:2020-08-27 13:51:55
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_speech
Versions:GIT Frequency of
Occurrence
Related
Issues:
is related toASTERISK-28019 Crash in ast_format_get_sample_rate when play an audio
Environment:Attachments:( 0) app_speech_utils.diff
Description:This issue has been raised many times, due to memory issues user often see in the logs with res_speech

[Feb 6 10:48:35] ERROR[17692][C-00000021] astobj2.c: FRACK!, Failed assertion bad magic number 0x0 for object 0x31990d8 (0)

Discussion here https://community.asterisk.org/t/astobj2-c-131-internal-obj-frack-failed-assertion-bad-magic-number/73439

The previous issue is ASTERISK-27986

The fix is not correct, the real issue seems that the new_speech->format variable is not bumped properly. best is released with RAII, format is released in ast_speech_destroy but it is never bumped.

In this code:

{code}
RAII_VAR(struct ast_format *, best, NULL, ao2_cleanup);
       ......

/* Can't forget the format audio is going to be in */
new_speech->format = best;

/* Pass ourselves to the engine so they can set us up some more and if they error out then do not create a structure */
if (engine->create(new_speech, best)) {
ast_mutex_destroy(&new_speech->lock);
ast_free(new_speech);
new_speech = NULL;
}
      return new_speech;
}

/*! \brief Destroy a speech structure */
int ast_speech_destroy(struct ast_speech *speech)
{
        ...
ao2_ref(speech->format, -1);
       ...
}
{code}

Comments:By: Asterisk Team (asteriskteam) 2020-08-21 16:39:19.468-0500

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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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: Friendly Automation (friendly-automation) 2020-08-27 13:51:56.651-0500

Change 14797 merged by George Joseph:
res_speech: Bump reference on format object

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

By: Friendly Automation (friendly-automation) 2020-08-27 13:52:15.977-0500

Change 14798 merged by George Joseph:
res_speech: Bump reference on format object

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

By: Friendly Automation (friendly-automation) 2020-08-27 13:52:39.597-0500

Change 14799 merged by George Joseph:
res_speech: Bump reference on format object

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

By: Friendly Automation (friendly-automation) 2020-08-27 13:53:25.967-0500

Change 14800 merged by George Joseph:
res_speech: Bump reference on format object

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

By: Friendly Automation (friendly-automation) 2020-08-27 13:53:40.497-0500

Change 14808 merged by George Joseph:
res_speech: Bump reference on format object

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