|Summary:||ASTERISK-19612: Asterisk crash with compiler flag LOW_MEMORY|
|Reporter:||Jean-Denis Girard (jdg)||Labels:|
|Date Opened:||2012-03-31 15:30:59||Date Closed:||2017-12-19 06:05:04.000-0600|
|Environment:||Attachments:||( 0) low_mem.txt|
|Description:||When using compiler flag LOW_MEMORY, asterisk-10 crashes as soon as an SIP call is made. I discovered that initially with asterisk-10.2.1, but same with 10.3.0, and I also tried 10.0.0-beta1. Verified on 2 completely different environments: Mandriva-2010.2 32 bits, and Fedora 16 64 bits. I'm running Asterisk on a Alix board, so low memory is preferred.|
|Comments:||By: Jean-Denis Girard (jdg) 2012-03-31 15:32:16.887-0500|
Backtrace on Fedora 16
By: Matt Jordan (mjordan) 2012-04-02 13:05:22.375-0500
This appears to be occurring due to rtp_engine requiring a significant amount of memory on the stack to handle codecs and preferences - or at least, more stack space then the system you are running on can provide. The rtp_engine was never designed to take into account low memory situations.
Please note that the LOW_MEMORY option is in extended support, and development support for it typically comes from the open source Asterisk developer community. As such, response times may reflect that.
By: Jean-Denis Girard (jdg) 2012-04-03 11:37:25.386-0500
Thanks for having a look.
The backtrace was taken on my portable computer, which has 4 Gb of memory, so I doubt the crash is due to not enough stack space.
I'd like to help troubleshoot this problem, what would you suggest?
By: Leif Madsen (lmadsen) 2012-04-18 11:03:43.009-0500
If I was going to guess, I suspect LOW_MEMORY actually limited the amount of memory that can be used, even if you have 4GB of RAM. Assuming that is the case, then as Matt pointed out, the rtp_engine is smashing the stack. I suspect you could try testing by loading only a minimal set of codecs (lets say JUST codec_ulaw) and see if that works around the issue.
By: Jean-Denis Girard (jdg) 2012-04-19 10:35:47.062-0500
Thanks for the suggestion, I will try that and report.
By: Matt Jordan (mjordan) 2012-05-11 10:46:07.313-0500
You may want to look into redefining AST_RTP_MAX_PT in rtp_engine.h to being a lower value then 256.
By: Jean-Denis Girard (jdg) 2012-05-12 19:50:28.048-0500
Setting AST_RTP_MAX_PT to 19 seems to work, at least I was able to use Echo application from a SIP channel. At AST_RTP_MAX_PT=20, Asterisk crashes, at 18 there is no crash but SIP call does not complete. I used Linphone with only PCMA codec during tests. I hope that helps, do you need more information?
By: Olle Johansson (oej) 2013-05-02 07:26:23.761-0500
Looking at the code I see that we allocate 256 structures for the payload handling, and in most call only use a handful. There has to be a way to make this more optimized to save memory. We should possibly only allocate this for calls that actually change the default payload format and then only allocate the changes.
By: Joshua C. Colp (jcolp) 2017-12-19 06:05:05.038-0600
This has been fixed in Asterisk 11 for awhile. Things are only allocated as used.