[Home]

Summary:ASTERISK-28699: ast_coredumper does not find asterisk running process and silently fails
Reporter:Addons Zz (addons_zz)Labels:
Date Opened:2020-01-17 14:17:30.000-0600Date Closed:
Priority:TrivialRegression?
Status:Open/NewComponents:Core/ACL
Versions:17.1.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:root@debian9:~/Downloads# cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"Attachments:
Description:I do not use command line configurations, because I had set:
File: /etc/asterisk/asterisk.conf
...
[options]
verbose = 3
debug = 0
highpriority = yes ; Run realtime priority (same as -p at
dumpcore = yes ; Dump core on crash (same as -g at startup).

Now, when I run:
root@debian9:~/Downloads# /var/lib/asterisk/scripts/ast_coredumper --running --latest

It outputs nothing. Then I edited the file `/var/lib/asterisk/scripts/ast_coredumper` and removed the line `set -e`

After that, when running the command, it started outputting:
root@debian9:~/Downloads# /var/lib/asterisk/scripts/ast_coredumper --running --latest
Asterisk is not running

However, I have the asterisk process up and running: (pid 11529)
root@debian9:~/Downloads# ps aux | grep asterisk
root     11529 26.2 14.5 2243256 73400 ?       SLsl 15:02  18:07 asterisk
root     11530  0.0  0.3  15232  1560 ?        S    15:02   0:00 astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 11529
root     27971  0.0  0.1 132344   964 pts/0    R+   16:11   0:00 grep --color=auto asterisk
root     29065  0.0  1.8  98488  9100 pts/6    S+   15:22   0:00 rasterisk r

I managed to make it work, by replacing the line `pids=$(pgrep -f "$asterisk_bin")` directly with my asterisk pid `pids=11529`:
root@debian9:~/Downloads# /var/lib/asterisk/scripts/ast_coredumper --running --latest
Found a single asterisk instance running as process 11529
WARNING:  Taking a core dump of the running asterisk instance will suspend call processing while the dump is saved.  Do you wish to continue? (y/N) y
Dumping running asterisk process to /tmp/core-asterisk-running-2020-01-17T17-21-35-0300
Processing /tmp/core-asterisk-running-2020-01-17T17-21-35-0300
Creating /tmp/core-asterisk-running-2020-01-17T17-21-35-0300-thread1.txt
Creating /tmp/core-asterisk-running-2020-01-17T17-21-35-0300-brief.txt
Creating /tmp/core-asterisk-running-2020-01-17T17-21-35-0300-full.txt
Creating /tmp/core-asterisk-running-2020-01-17T17-21-35-0300-locks.txt
Comments:By: Asterisk Team (asteriskteam) 2020-01-17 14:17:31.292-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Sean Bright (seanbright) 2020-01-17 15:56:06.817-0600

Can you change the {{set -e}} to a {{set -x}}, capture the output of the script, and attach it to this issue?

By: Asterisk Team (asteriskteam) 2020-02-01 12:00:01.417-0600

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

By: Addons Zz (addons_zz) 2020-02-03 08:11:59.721-0600

Sorry for the late reply. My email provider had put your emails on the spam directory and I only saw them today.

This is the result of the command you asked me to run, after changing `set -e` to  `set -x`:

{noformat}
root@debian9:(master)~# ps axu | grep asterisk
root      6191  0.3  3.7 5331200 76036 ?       SLsl jan31  12:40 asterisk
root      6192  0.0  0.0  15232  1628 ?        S    jan31   0:01 astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 6191
root     29615  0.0  0.3  93920  7560 pts/2    S+   09:57   0:00 rasterisk r
root     29735  0.0  0.0 132344   972 pts/1    S+   09:58   0:00 grep --color=auto asterisk

root@debian9:(master)~# /var/lib/asterisk/scripts/ast_coredumper --running --latest
++ basename /var/lib/asterisk/scripts/ast_coredumper
+ prog=ast_coredumper
+ '[' 0 -ne 0 ']'
+ running=false
+ RUNNING=false
+ latest=false
+ tarball_coredumps=false
+ tarball_config=false
+ delete_coredumps_after=false
+ tarball_results=false
+ delete_results_after=false
+ append_coredumps=false
+ declare -a COREDUMPS
+ declare -a ARGS_COREDUMPS
+ '[' -f ./ast_debug_tools.conf ']'
+ '[' -f /root/ast_debug_tools.conf ']'
+ '[' -f /etc/asterisk/ast_debug_tools.conf ']'
+ readconf /etc/asterisk/ast_debug_tools.conf
++ sed -r -e '/\s*#/d' -e '/^\s*$/d' /etc/asterisk/ast_debug_tools.conf
+ read line
+ v=COREDUMPS
+ '[' -z '' ']'
+ eval 'COREDUMPS=(/tmp/core[-._]asterisk!(*.txt)' '/tmp/core[-._]$(hostname)!(*.txt))'
++ COREDUMPS=(/tmp/core[-._]asterisk!(*.txt) /tmp/core[-._]$(hostname)!(*.txt))
+++ hostname
+ read line
+ v=OUTPUTDIR
+ '[' -z '' ']'
+ eval OUTPUTDIR=/tmp
++ OUTPUTDIR=/tmp
+ read line
+ v=DATEFORMAT
+ '[' -z '' ']'
+ eval 'DATEFORMAT='\''date' '+%FT%H-%M-%S%z'\'''
++ DATEFORMAT='date +%FT%H-%M-%S%z'
+ read line
+ v=LOGFILES
+ '[' -z '' ']'
+ eval 'LOGFILES=(/var/log/asterisk/messages*' /var/log/asterisk/queue_log '/var/log/asterisk/debug*' '/var/log/asterisk/security*)'
++ LOGFILES=(/var/log/asterisk/messages* /var/log/asterisk/queue_log /var/log/asterisk/debug* /var/log/asterisk/security*)
+ read line
+ v=LOG_DATEFORMAT
+ '[' -z '' ']'
+ eval 'LOG_DATEFORMAT="%m/%d-%H:%M:%S.%f"'
++ LOG_DATEFORMAT=%m/%d-%H:%M:%S.%f
+ read line
++ which -a gdb
+ for g in $(which -a gdb)
++ /usr/bin/gdb --batch --ex 'python print('\''hello'\'')'
+ result=hello
+ [[ hello =~ ^hello$ ]]
+ GDB=/usr/bin/gdb
+ break
+ '[' -z /usr/bin/gdb ']'
+ '[' -n /tmp ']'
+ '[' '!' -d /tmp ']'
+ '[' 2 -eq 0 ']'
+ DATEFORMAT='date +%FT%H-%M-%S%z'
+ for a in "$@"
+ case "$a" in
+ running=true
+ for a in "$@"
+ case "$a" in
+ latest=true
+ for i in ${!COREDUMPS[@]}
+ '[' '!' -f '/tmp/core[-._]asterisk!(*.txt)' ']'
+ unset 'COREDUMPS[0]'
+ continue
+ for i in ${!COREDUMPS[@]}
+ '[' '!' -f '/tmp/core[-._]debian9!(*.txt)' ']'
+ unset 'COREDUMPS[1]'
+ continue
+ IFS='
'
+ readarray -t COREDUMPS
++ echo -n ''
++ sort -u
+ unset IFS
+ '[' 0 -gt 0 ']'
++ date +%FT%H-%M-%S%z
+ df=2020-02-03T09-57-52-0300
+ '[' x = x ']'
++ which asterisk
+ asterisk_bin=/usr/sbin/asterisk
+ true
+ unset pid
++ pgrep -f /usr/sbin/asterisk
+ pids=
++ echo
++ wc -w
+ pidcount=0
+ '[' 0 -eq 0 ']'
+ echo 'Asterisk is not running'
Asterisk is not running
+ exit 1
{noformat}

By: Asterisk Team (asteriskteam) 2020-02-03 08:12:00.448-0600

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Benjamin Keith Ford (bford) 2020-02-04 10:47:44.662-0600

I was able to replicate this, so I'll go ahead and open up a ticket for it.