Debug Asterisk when it suddenly stops responding

Greetings
need advice on how i can properly gather debug/log info
regarding this thread
(Asterisk 18.20.2 is suddenly stopped responding - #8 by SamShomi)

The issue occurs randomly once a month propably
after applying changes (adding Extension or adding DDI) asterisk stops responding.
(we are applying changes several times per day)
but I can still connect to asterisk CLI asterisk -rx so probably it is not crashing

@BlazeStudios advice was to get a backtrace
https://sangomakb.atlassian.net/wiki/spaces/SS/pages/31162494/Providing+Great+Debug
but after fwconsole dbug I need to reproduce the issue which cannot be reproducible
because it already appears

1- The core dump is not there

ls -l /tmp | grep core.

2- When Asterisk is still accessible but there is no core dump file I assume it did not crash but just hung. In this case I would need to use this command?

/var/lib/asterisk/scripts/ast_coredumper --running --tarball-coredumps

Please advice

We have a similar issue… where the next step is also to take a backtrace.
From what I understood in my post, it’s not yet possible on Debian:

Incorrect, Asterisk can be compiled to provide backtraces on any version of Debian (by my experience since Wheezy (7) ). That Sangoma have not done yet is a different story.

im using Freepbx 15 (FreePBX 17 is too new for production)

I’m I right that I need run that command?

ast_coredumper

What version of Asterisk are you running?


i this issue exist on all of them

I’m thinking that if this issue occurs when clicking “Apply Changes”, the cause might be related to how we use func_odbc with a local MySQL database to determine the correct route path.

For example, with 50 concurrent calls, each call queries MySQL through the ODBC driver, generating 50 simultaneous database queries.

At the same time, when we click “Apply Changes” in FreePBX, it also executes multiple SQL queries to retrieve configurations and regenerate config files.

This makes me wonder if we might be overloading MySQL or ODBC due to the combined load of call-related queries and FreePBX configuration updates.

Although I haven’t looked at the actual transactions, my understanding is that apply changes is just a report generation operation, so should only do read accesses, on the SQL database. I think is only things like CDRs that involve write locks at run time, and they wouldn’t be read, so shouldn’t get read locks.

The actual working configuration, in Asterisk, is held in memory, an constructed from flat files, output by the report generation step, so done after access to the FreePBX database has ended.

Consider that “Apply changes” also involves re-writing sqlite3 tables, I have long suspected that the asterisk ‘database’ code is not as rubust as it could be since moving from Berkeley to sqlite3, Asterisk itself has no awareness of mysql/mariadb outside of it’s add-on cdr odbc driver.

I suspect it has the same locking granularity as the Berkeley one, so difficult to deadlock. I don’t know if FreePBX uses non-trivial transactions, though, when loading it.

It is easy to ‘deadlock’, open a connection to /var/lib/asterisk/astdb.sqlite3 by any method that is not the ongoing asterisk user one and continually even just read data, in short order the database will be locked. BTDT

in short
will it be enough to run on an asterisk hang?
(so needed debug is retrieved )

/var/lib/asterisk/scripts/ast_coredumper --running --tarball-coredumps

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.