[Home]

Summary:ASTERISK-20612: Segmentation fault related to pthread stack size with LOW MEMORY compiler flag selected
Reporter:Stephen Hinton (stevester)Labels:
Date Opened:2012-10-28 23:41:11Date Closed:2013-01-04 09:30:23.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:General
Versions:10.10.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Debian Wheezy with all updates (DebWrt), Asus RT-N16 router (480Mhz, 128mb ram, O/S on usb)Attachments:
Description:Compiled asterisk with the low memory flag selected. Upon trying to start asterisk manually (asterisk -cvvvd) the following output is printed:

"utils.c:1056 ast_pthread_create_stack: pthread_attr_setstacksize: Invalid argument"

When starting with amportal start:

"(debwrt-mipsel)root@debwrt:~# amportal start

Please wait...

SETTING FILE PERMISSIONS
chown: cannot access `/dev/tty9': No such file or directory
Permissions OK

STARTING ASTERISK
pthread_attr_setstacksize: Invalid argument
Segmentation fault
Asterisk ended with exit status 139
Asterisk exited on signal 11.
Automatically restarting Asterisk."
Comments:By: Stephen Hinton (stevester) 2012-10-28 23:45:06.154-0500

It is also worth noting that without the Low Memory compiler flag this issue is not created.

By: Matt Jordan (mjordan) 2012-10-29 20:38:59.219-0500

Thank you for your bug report. In order to move your issue forward, we require a backtrace[1] from the core file produced after the crash. Also, be sure you have DONT_OPTIMIZE enabled in menuselect within the Compiler Flags section, then:

make install

After enabling, reproduce the crash, and then execute the backtrace[1] instructions. When complete, attach that file to this issue report.

[1] https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

A few other points.

The LOW_MEMORY compile time option is an extended support feature.  As such, development support for it typically comes from the Asterisk developer community, and response times may reflect that.

On that same vein, using the LOW_MEMORY compile time option will most likely run into several known problem areas where exceptionally large amounts of stack memory are needed.  While developers have historically attempted to provide LOW_MEMORY options; sometimes, this has either not been possible or noticed.  Patches are certainly welcome to fix any known trouble areas, but you may need to "get your hands dirty" in Asterisk to run Asterisk with this option.

By: Stephen Hinton (stevester) 2012-11-01 00:40:08.540-0500

Hi Matt, I am having problems generating a backtrace. You see the segmentation fault only occurs when launching asterisk via amportal in FreePBX whereas when launching asterisk standalone you get the same error but no segmentation fault. Please advise as to how to proceed, could not find a core file

By: Matt Jordan (mjordan) 2012-11-01 08:34:56.005-0500

I want to reiterate before we go any further into the debugging process that the LOW_MEMORY compile time option is not a trivial option to enable.  You will have to get into the Asterisk code at some point in time to iron out any wrinkles in specific modules that are loaded - not every module has had perfect compliance with this option.  If you aren't in a position where that's something you're willing to do, I wouldn't go any further down this road.

That being said, if you *are* willing to get into the Asterisk code, there's a few things you can do:
* Determine which module is causing the thread attribute error.  Attach a DEBUG log that clearly shows where the error occurs - that should narrow down which module is loading, creating a thread, and doing it improperly.
* amportal is a FreePBX item; as such, I'm not able to tell you why it would cause a crash while loading Asterisk independent of it will not.  You might want to contact the FreePBX folks and have them take a look and/or comment on this issue.
* Are you starting Asterisk with the '-g' flag?  That is necessary for a core file to be produced.
* The core file, by default, should be produced in the directory that Asterisk is launched from.  System configuration parameters, however, can change that location, as well as the core file name.  You may need to inspect your system to determine if anything has been set that changes where core files are produced.



By: Matt Jordan (mjordan) 2012-11-01 08:36:01.871-0500

I should also add that I enabled LOW_MEMORY in a fresh checkout of 10 (which is essentially 10.10 at this point) and launched Asterisk.  I did not get the error that you referenced, nor did it crash.  Of course, all that means is for the modules on my system, none of them caused your particular problem.  A log file should indicate which module is causing the problem.

By: Rusty Newton (rnewton) 2012-11-27 17:34:12.212-0600

Stephen, do you need further time to gather and provide the debug requested above? Or did you resolve the issue?

By: Rusty Newton (rnewton) 2013-01-04 09:30:23.547-0600

If the requested debug can be gathered, and a method of reproduction can be described, this can be reopened by contacting a bug marshal in irc.freenode.net  #asterisk-bugs