[Home]

Summary:ASTERISK-23141: Asterisk crashes on Dial(), in pbx_find_extension at pbx.c
Reporter:Maxim (supermaxiko)Labels:
Date Opened:2014-01-15 02:28:44.000-0600Date Closed:2014-02-21 20:32:03.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Applications/app_dial
Versions:11.7.0 Frequency of
Occurrence
Occasional
Related
Issues:
Environment:Description: Debian GNU/Linux 6.0.7 (squeeze) Release: 6.0.7 Codename: squeeze Attachments:( 0) backtrace.txt
( 1) cleanup-AST_PBX_MAX_STACK.patch
Description:Istalled asterisk 11.7, but it crashes on executing Dial() with segfault in syslog

Jan 15 14:58:10 IBM-new-gw kernel: [18189314.280726] asterisk[29153]: segfault at 7f9500000081 ip 00007f95499549c4 sp 00007f95441bb988 error 4 in libc-2.11.3.so[7f95498d5000+159000]
Jan 15 15:13:29 IBM-new-gw kernel: [18190230.877973] asterisk[17118]: segfault at 81 ip 00007fde1f1329c4 sp 00007fddfb9a2d38 error 4 in libc-2.11.3.so[7fde1f0b3000+159000]
Jan 15 15:15:03 IBM-new-gw kernel: [18190325.257799] asterisk[17485]: segfault at 7f6a00000081 ip 00007f6a3fa769c4 sp 00007f6a1c28c8d8 error 4 in libc-2.11.3.so[7f6a3f9f7000+159000]
Jan 15 15:15:29 IBM-new-gw kernel: [18190351.050684] asterisk[18868]: segfault at 7fee00000081 ip 00007fee4f5929c4 sp 00007fee47c5e618 error 4 in libc-2.11.3.so[7fee4f513000+159000]
Comments:By: Maxim (supermaxiko) 2014-01-15 02:35:38.951-0600

backtrace from core

By: Richard Mudgett (rmudgett) 2014-01-15 10:31:39.158-0600

Was a dialplan reload in progress when the crash happened?

By: Maxim (supermaxiko) 2014-01-15 22:06:04.381-0600

No dialplan reload.

By: Corey Farrell (coreyfarrell) 2014-01-16 15:08:04.677-0600

The thing I'm noticing is that q->stacklen == 129, but AST_PBX_MAX_STACK is 128.  Does your copy of asterisk have any patches to main/pbx.c?  I ask because your backtrace says strcasecmp was called at pbx.c:3147 with x==128.  This is immediately after pbx_find_extension should have returned due to q->stacklen > AST_PBX_MAX_STACK.

By: Maxim (supermaxiko) 2014-01-17 04:43:36.590-0600

I changed AST_PBX_MAX_STACK only in main/pbx.c up to 1024 due error "Maximum PBX stack exceeded" because i have pretty big dialpan with a lot if includes.

I also noticed that AST_PBX_MAX_STACK defines in multiply files:
main/pbx.c
utils/conf2ael.c
utils/extconf.c
res/ael/pval.c
Is it normal?(I'm not skilled in C :) )

By: Richard Mudgett (rmudgett) 2014-01-17 11:11:21.653-0600

Exceeding AST_PBX_MAX_STACK is not a good thing.  It suggests that you have an include loop in your dialplan.  Context A includes context B which then includes context A.

By: Maxim (supermaxiko) 2014-01-20 22:05:17.993-0600

There is no loops. Asterisk 1.4 works fine, but 11.7 crashes (with converted dialplan ofcourse)

By: Corey Farrell (coreyfarrell) 2014-01-21 20:08:06.078-0600

The attached patch ensures AST_PBX_MAX_STACK is defined by:
include/asterisk/pbx.h
include/asterisk/extconf.h
utils/extconf.c - this file should probably include asterisk/extconf.h, but it doesn't so I left the AST_PBX_MAX_STACK define in place.

The crash was caused by increasing the value in main/pbx.c but not in pbx.h.

By: Rusty Newton (rnewton) 2014-01-29 09:56:05.637-0600

@Maxim, can you test the patch and report back? Thanks!

By: Maxim (supermaxiko) 2014-02-05 03:07:44.354-0600

@Rusty Newton, sorry for waiting so long. Everything is OK! No crashes.

By: Rusty Newton (rnewton) 2014-02-19 21:02:48.438-0600

Thanks Maxim. Assigning this to Corey so he can move forward with it.