[Home]

Summary:ASTERISK-25706: pbx: Abort asterisk on features reload (handle_hint_change)
Reporter:Krzysztof Trempala (kristophert)Labels:
Date Opened:2016-01-19 08:35:16.000-0600Date Closed:2016-08-19 06:22:12
Priority:CriticalRegression?
Status:Closed/CompleteComponents:Core/PBX
Versions:11.21.0 13.7.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-25750 features: Crash occurs when executing a "features reload"
is duplicated byASTERISK-26290 User login - double free or corruption (out)
is duplicated byASTERISK-25827 crash asterisk with dialplan add extension
is duplicated byASTERISK-26270 Asterisk crashes with double free or corruption on AGI request
Environment:UbuntuAttachments:( 0) 0008-handle_hint_change-initialize-presence_state.patch
( 1) backtrace.txt
( 2) pbx_11.22.0.patch
Description:Asterisk reseting on features reload.
Logs from core:
{code}
#4  0x0816eda4 in handle_hint_change (data=0xb6b1148c) at pbx.c:6099
       hint = 0xb6b1148c
       hint_app = 0xb6b4d5d8
       state = 0
       presence_state = {provider = 0x82dc264 "", state = 7, subtype = 0x81bc405 "\270", message = 0x0}
....
{code}
Crash on "ast_free(presence_state.subtype);" in function handle_hint_change(). Variable presence_state.subtype and presence_state.message is no set. Function extension_presence_state_helper() return state = AST_PRESENCE_INVALID.
Code:
{code}
static int handle_hint_change(void *data)
{
struct ast_hint *hint = data;
struct ast_str *hint_app;
int state;
struct presencechange presence_state;

if (!(hint_app = ast_str_create(1024))) {
return -1;
}

device_state_notify_callbacks(hint, &hint_app);

state = extension_presence_state_helper(
hint->exten, &presence_state.subtype, &presence_state.message);

presence_state.state = state > 0 ? state : AST_PRESENCE_INVALID;

presence_state_notify_callbacks(AST_EVENT_HINT_CHANGE, hint, &hint_app, &presence_state);

ast_free(hint_app);
ao2_ref(hint, -1);

ast_free(presence_state.subtype);  <==== crash here
ast_free(presence_state.message);

return 0;
}
{code}
Comments:By: Asterisk Team (asteriskteam) 2016-01-19 08:35:17.535-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].

By: Richard Mudgett (rmudgett) 2016-03-21 16:46:07.594-0500

The fix for ASTERISK-25640 might be a cause for the crash.

By: Sébastien Couture (sysreq) 2016-06-02 13:33:17.676-0500

I'm experiencing the same issue under 11.22.0. I've attached a backtrace.

By: Tzafrir Cohen (tzafrir) 2016-06-05 03:21:54.289-0500

A patch that seems to fix a similar issue here.

By: Tzafrir Cohen (tzafrir) 2016-06-05 03:25:04.687-0500

FWIW, in our case 11.7.0 did not have the issue, and thus I indeed ASTERISK-25640 looks suspicious.

Sebastian, can you check this patch?

By: Sébastien Couture (sysreq) 2016-06-06 10:39:17.143-0500

The patch does seem to prevent Asterisk from crashing, but I now get the following warning:

{{WARNING[7097]: event.c:1502 handle_event: cache requested for non-cached event type}}

I've also attached a version of the patch ported to Asterisk 11.22.0.

By: Tzafrir Cohen (tzafrir) 2016-06-06 11:03:30.544-0500

As an aside, that error message fails to mention the ID of the type that is not cached.

By: David Wilson (dcdata) 2016-08-12 05:55:27.104-0500

I can confirm that "0008-handle_hint_change-initialize-presence_state.patch" applied to asterisk-11.21.0 addressed our issue experienced when logging in using Device & User mode under FreePBX. Thank you very much!

By: Rusty Newton (rnewton) 2016-08-15 14:45:34.251-0500

If this patch is working for some people, probably want to get it on Gerrit to get more eyes on it.

By: Sylvester Kuisis (gl1tchh) 2016-08-24 03:35:38.828-0500

FYI, the patch for 11.21.0 works for 11.21.x as well.