Yesterday I spent way too long troubleshooting an issue with an Asteirsk server that I hadn’t seen before, so I thought I’d do a short write-up here in case anyone else sees similar symptoms.
The system is running Asterisk 1.8 with FreePBX 2.8 and FOP2.
The symptoms were a little erratic but included –
– CPU for Asterisk process climbed to 100% and stayed there
– FreePBX gave message when trying to Apply Setting regarding a problem with retrieve_conf
– Running ‘sip show peers’ in the Asterisk console would not list any peers (there were around 50)
– Running ‘sip show peers’ again would cause the Asterisk console to freeze
– Asterisk process showed 800mb of VIRT mem usage
– Starting Asterisk would cause 3 or 4 SEGFAULT messages before safe_asterisk finally managed to start the Asterisk process
What I tried to resolve the issue –
– Upgraded Asterisk to the latest 1.8 release made no difference
– Restore the Asterisk .conf files from a previous days backup made no difference
– Disabling some of the Asterisk modules would sometimes cause the Asterisk process to start correctly, with low CPU usage. This was intermittent though and there was no clear pointer to any specific module
The solution –
It actually turned out to be a corrupt Asterisk Database (AstDB) file. This is normally stored here – /var/lib/asterisk/astdb and records some settings about follow-me’s, caller ids, etc. Renaming this file enabled Asterisk to start correctly. Asterisk will create another file but if you’re running FreePBX you need to go to every extension and click ‘Submit’ and then ‘Apply Changes’ at the end to recreate the extension settings in that file.
If you’re having to track down what is causing high CPU usage in Asterisk then here is a really great blog post describing a process to find exactly what part of the Asterisk code is causing the issue.
It might give you some pointers to where the problem lies –