[asterisk-bugs] [JIRA] (ASTERISK-28699) ast_coredumper does not find asterisk running process and silently fails

Addons Zz (JIRA) noreply at issues.asterisk.org
Mon Feb 3 08:12:25 CST 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=249645#comment-249645 ] 

Addons Zz commented on ASTERISK-28699:
--------------------------------------

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`:
root at 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 at 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


> ast_coredumper does not find asterisk running process and silently fails
> ------------------------------------------------------------------------
>
>                 Key: ASTERISK-28699
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28699
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/ACL
>    Affects Versions: 17.1.0
>         Environment: root at 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/"
>            Reporter: Addons Zz
>            Severity: Trivial
>
> 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 at 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 at 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 at 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 at 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



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list