[Home]

Summary:ASTERISK-28734: Segmentation fault when calling ast_format_get_codec_id
Reporter:christian schuch (scumpos)Labels:
Date Opened:2020-02-11 03:08:25.000-0600Date Closed:2020-02-11 08:56:32.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Formats/General
Versions:13.30.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:embedded system (i586), Asterisk 13, pocketsphinx, astsphinxAttachments:( 0) core.5080
Description:I've built a voice recognition system for german digits using asterisk 13, pocketsphinx and a plugin and server (based on astsphinx) to connect asterisk with pocketsphinx. When testing the system with calls where wav files are played to the recognition engine everything works fine until about the 50th call. Asterisk then crashes with a segmentation fault and restarts. Reading the gdb backtrace I've found out that the problem occurs, when the format codec id is selected.

This is the gdb backtrace:

{noformat}
[New process 21378]
#0  0x08155419 in ast_format_get_codec_id (format=0xb6d0cae0) at format.c:319
319 format.c: No such file or directory.
in format.c
(gdb) bt
#0  0x08155419 in ast_format_get_codec_id (format=0xb6d0cae0) at format.c:319
#1  0x081592ad in ast_format_cap_get_compatible (cap1=0xb506b188, cap2=0x8b2c110, result=0x8b3a908) at format_cap.c:591
#2  0xb6e026a8 in ast_speech_new (engine_name=0xb4ed0fa8 "Sphinx-En", cap=0x8b2c110) at res_speech.c:198
#3  0xb61fcf2f in speech_create (chan=0x8b279c0, data=0xb4ed0fa8 "Sphinx-En") at app_speech_utils.c:551
#4  0x081bec23 in pbx_exec (c=0x8b279c0, app=0xb59ad958, data=0xb4ed0fa8 "Sphinx-En") at pbx_app.c:494
#5  0x081b6973 in pbx_extension_helper (c=0x8b279c0, con=0x0, context=0x8b28048 "/25", exten=0x8b28098 "3000", priority=3, label=0x0,
   callerid=0xb4d045c0 "25", action=E_SPAWN, found=0xb4ed3348, combined_find_spawn=1) at pbx.c:2886
#6  0x081bba90 in __ast_pbx_run (c=0x8b279c0, args=0x0) at pbx.c:4111
#7  0x081bd580 in pbx_thread (data=0x8b279c0) at pbx.c:4610
#8  0x08234c1b in dummy_start (data=0x8b27480) at utils.c:1239
#9  0xb7245e6c in ?? () from /lib/libpthread.so.0
#10 0x08b27480 in ?? ()
#11 0x00000000 in ?? ()
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2020-02-11 03:08:27.316-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: christian schuch (scumpos) 2020-02-11 03:13:59.228-0600

core dump after asterisk crash

By: Joshua C. Colp (jcolp) 2020-02-11 08:56:32.396-0600

Please file an issue with Sangoma per your support agreement so this may be looked into following the proper process.

By: Alexander Hömig (ahoemig) 2020-02-20 05:25:22.819-0600

Hello Joshua,

Christian's SEFFAULT happens, because there is a bug ( matt-jordan committed on 21 Jul 2014, media formats: re-architect handling of media for performance improve…) in res_speech.c.

In the function: struct ast_speech *ast_speech_new(const char *engine_name, const struct ast_format_cap *cap)
is the variable definition:

RAII_VAR(struct ast_format *, best, NULL, ao2_cleanup);

not correct, because best will not allocated here. best only points to ast_format_slin.
If the function returns, ao2_cleanup decrements the reference from ast_format_slin and this is wrong.

Replace:
RAII_VAR(struct ast_format *, best, NULL, ao2_cleanup);
with:
struct ast_format *best=NULL;

and no crash happens (after ~45 calls of the speech-api).

Regards,

A. Hömig