Package: tor

In function wait_for_deaddaemon the construct

if [ $cnt -gt $WAITFORDAEMON ]
then
   log_action_end_msg 1 "still running"
fi

continues forever if Tor can not be killed for some reason. (Why Tor
could not be
killed in the first place is another bug, which I haven't managed to
reproduce yet.)

(You can easily test this condition by adding "pid=0000" below

log_action_begin_msg "Stopping $DESC"
pid=`cat $TORPID 2>/dev/null` || true
pid=0000

but you're probably a better coder than I am and know that. Just saying
for everyone else reading this and myself. I added just that so I can
demonstrate it.)

This is how it will look if killing the Tor process won't work for some
reason:
~ $ sudo service tor stop
[FAIL] Stopping tor
daemon...............................................................failed
(still running).
failed (still running).
[FAfailed (still running).
failed (still running).
failed (still running).
[FAfailed (still running).
failed (still running).
failed (still running)
(added by me: ...continues forever.)

Maybe it would be better to use start-stop-daemon with --signal combined
with --retry? (Which would essentially sends signal SIGTERM to Tor, wait
a defined amount of time and if tor is still running, forcefully kill it
using SIGKILL.)

Below I'll attach the bash -x output:

~ $ sudo bash -x /etc/init.d/tor stop
+ . /lib/init/vars.sh
++ TMPTIME=0
++ SULOGIN=no
++ DELAYLOGIN=no
++ UTC=yes
++ VERBOSE=no
++ FSCKFIX=no
++ '[' -f /etc/default/rcS ']'
++ . /etc/default/rcS
++ unset EDITMOTD
++ unset RAMRUN
++ unset RAMLOCK
++ '[' -r /proc/cmdline ']'
+++ cat /proc/cmdline
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ '[' '' ']'
+ . /lib/lsb/init-functions
+++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
++ for hook in '$(run-parts --lsbsysinit --list
/lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
++ . /lib/lsb/init-functions.d/20-left-info-blocks
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/sbin/tor
+ NAME=tor
+ DESC='tor daemon'
+ TORPIDDIR=/var/run/tor
+ TORPID=/var/run/tor/tor.pid
+ DEFAULTSFILE=/etc/default/tor
+ WAITFORDAEMON=60
+ DEFAULT_ARGS='--defaults-torrc /usr/share/tor/tor-service-defaults-torrc'
+ VERIFY_ARGS='--verify-config --defaults-torrc
/usr/share/tor/tor-service-defaults-torrc'
+ USE_AA_EXEC=yes
+ ARGS=
+ '[' no '!=' yes ']'
+ ARGS=' --hush'
+ '[' -r /proc/sys/fs/file-max ']'
++ cat /proc/sys/fs/file-max
+ system_max=102160
+ '[' 102160 -gt 80000 ']'
+ MAX_FILEDESCRIPTORS=32768
+ NICE=
+ test -x /usr/sbin/tor
+ '[' -f /etc/default/tor ']'
+ . /etc/default/tor
++ RUN_DAEMON=yes
++ CLEANUP_OLD_COREFILES=y
++ '[' -e /etc/default/tor.vidalia ']'
++ PRE_START=/home/user/testxxx
++ PRE_START=
+ case "$1" in
+ log_action_begin_msg 'Stopping tor daemon'
+ log_action_begin_msg_pre 'Stopping tor daemon'
+ log_daemon_msg_pre 'Stopping tor daemon'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z ']'
+ FANCYTTY=1
+ case "$FANCYTTY" in
+ true
+ echo -n '[....] '
[....] + echo -n 'Stopping tor daemon...'
Stopping tor daemon...+ log_action_begin_msg_post 'Stopping tor daemon'
+ :
++ cat /var/run/tor/tor.pid
+ pid=4877
+ pid=0000
+ test '!' -f /var/run/tor/tor.pid -o -z 0000
+ start-stop-daemon --stop --signal INT --quiet --pidfile
/var/run/tor/tor.pid --exec /usr/sbin/tor
+ wait_for_deaddaemon 0000
+ pid=0000
+ sleep 1
+ test -n 0000
+ kill -0 0000
+ cnt=0
+ kill -0 0000
++ expr 0 + 1
+ cnt=1
+ '[' 1 -gt 60 ']'
+ sleep 1
++ expr 1 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 1 + 1
+ cnt=2
+ '[' 2 -gt 60 ']'
+ sleep 1
++ expr 2 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 2 + 1
+ cnt=3
+ '[' 3 -gt 60 ']'
+ sleep 1
++ expr 3 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 3 + 1
+ cnt=4
+ '[' 4 -gt 60 ']'
+ sleep 1
++ expr 4 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 4 + 1
+ cnt=5
+ '[' 5 -gt 60 ']'
+ sleep 1
++ expr 5 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 5 + 1
+ cnt=6
+ '[' 6 -gt 60 ']'
+ sleep 1
++ expr 6 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 6 + 1
+ cnt=7
+ '[' 7 -gt 60 ']'
+ sleep 1
++ expr 7 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 7 + 1
+ cnt=8
+ '[' 8 -gt 60 ']'
+ sleep 1
++ expr 8 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 8 + 1
+ cnt=9
+ '[' 9 -gt 60 ']'
+ sleep 1
++ expr 9 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 9 + 1
+ cnt=10
+ '[' 10 -gt 60 ']'
+ sleep 1
++ expr 10 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 10 + 1
+ cnt=11
+ '[' 11 -gt 60 ']'
+ sleep 1
++ expr 11 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 11 + 1
+ cnt=12
+ '[' 12 -gt 60 ']'
+ sleep 1
++ expr 12 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 12 + 1
+ cnt=13
+ '[' 13 -gt 60 ']'
+ sleep 1
++ expr 13 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 13 + 1
+ cnt=14
+ '[' 14 -gt 60 ']'
+ sleep 1
++ expr 14 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 14 + 1
+ cnt=15
+ '[' 15 -gt 60 ']'
+ sleep 1
++ expr 15 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 15 + 1
+ cnt=16
+ '[' 16 -gt 60 ']'
+ sleep 1
++ expr 16 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 16 + 1
+ cnt=17
+ '[' 17 -gt 60 ']'
+ sleep 1
++ expr 17 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 17 + 1
+ cnt=18
+ '[' 18 -gt 60 ']'
+ sleep 1
++ expr 18 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 18 + 1
+ cnt=19
+ '[' 19 -gt 60 ']'
+ sleep 1
++ expr 19 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 19 + 1
+ cnt=20
+ '[' 20 -gt 60 ']'
+ sleep 1
++ expr 20 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 20 + 1
+ cnt=21
+ '[' 21 -gt 60 ']'
+ sleep 1
++ expr 21 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 21 + 1
+ cnt=22
+ '[' 22 -gt 60 ']'
+ sleep 1
++ expr 22 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 22 + 1
+ cnt=23
+ '[' 23 -gt 60 ']'
+ sleep 1
++ expr 23 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 23 + 1
+ cnt=24
+ '[' 24 -gt 60 ']'
+ sleep 1
++ expr 24 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 24 + 1
+ cnt=25
+ '[' 25 -gt 60 ']'
+ sleep 1
++ expr 25 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 25 + 1
+ cnt=26
+ '[' 26 -gt 60 ']'
+ sleep 1
++ expr 26 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 26 + 1
+ cnt=27
+ '[' 27 -gt 60 ']'
+ sleep 1
++ expr 27 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 27 + 1
+ cnt=28
+ '[' 28 -gt 60 ']'
+ sleep 1
++ expr 28 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 28 + 1
+ cnt=29
+ '[' 29 -gt 60 ']'
+ sleep 1
++ expr 29 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 29 + 1
+ cnt=30
+ '[' 30 -gt 60 ']'
+ sleep 1
++ expr 30 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 30 + 1
+ cnt=31
+ '[' 31 -gt 60 ']'
+ sleep 1
++ expr 31 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 31 + 1
+ cnt=32
+ '[' 32 -gt 60 ']'
+ sleep 1
++ expr 32 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 32 + 1
+ cnt=33
+ '[' 33 -gt 60 ']'
+ sleep 1
++ expr 33 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 33 + 1
+ cnt=34
+ '[' 34 -gt 60 ']'
+ sleep 1
++ expr 34 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 34 + 1
+ cnt=35
+ '[' 35 -gt 60 ']'
+ sleep 1
++ expr 35 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 35 + 1
+ cnt=36
+ '[' 36 -gt 60 ']'
+ sleep 1
++ expr 36 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 36 + 1
+ cnt=37
+ '[' 37 -gt 60 ']'
+ sleep 1
++ expr 37 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 37 + 1
+ cnt=38
+ '[' 38 -gt 60 ']'
+ sleep 1
++ expr 38 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 38 + 1
+ cnt=39
+ '[' 39 -gt 60 ']'
+ sleep 1
++ expr 39 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 39 + 1
+ cnt=40
+ '[' 40 -gt 60 ']'
+ sleep 1
++ expr 40 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 40 + 1
+ cnt=41
+ '[' 41 -gt 60 ']'
+ sleep 1
++ expr 41 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 41 + 1
+ cnt=42
+ '[' 42 -gt 60 ']'
+ sleep 1
++ expr 42 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 42 + 1
+ cnt=43
+ '[' 43 -gt 60 ']'
+ sleep 1
++ expr 43 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 43 + 1
+ cnt=44
+ '[' 44 -gt 60 ']'
+ sleep 1
++ expr 44 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 44 + 1
+ cnt=45
+ '[' 45 -gt 60 ']'
+ sleep 1
++ expr 45 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 45 + 1
+ cnt=46
+ '[' 46 -gt 60 ']'
+ sleep 1
++ expr 46 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 46 + 1
+ cnt=47
+ '[' 47 -gt 60 ']'
+ sleep 1
++ expr 47 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 47 + 1
+ cnt=48
+ '[' 48 -gt 60 ']'
+ sleep 1
++ expr 48 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 48 + 1
+ cnt=49
+ '[' 49 -gt 60 ']'
+ sleep 1
++ expr 49 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 49 + 1
+ cnt=50
+ '[' 50 -gt 60 ']'
+ sleep 1
++ expr 50 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 50 + 1
+ cnt=51
+ '[' 51 -gt 60 ']'
+ sleep 1
++ expr 51 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 51 + 1
+ cnt=52
+ '[' 52 -gt 60 ']'
+ sleep 1
++ expr 52 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 52 + 1
+ cnt=53
+ '[' 53 -gt 60 ']'
+ sleep 1
++ expr 53 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 53 + 1
+ cnt=54
+ '[' 54 -gt 60 ']'
+ sleep 1
++ expr 54 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 54 + 1
+ cnt=55
+ '[' 55 -gt 60 ']'
+ sleep 1
++ expr 55 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 55 + 1
+ cnt=56
+ '[' 56 -gt 60 ']'
+ sleep 1
++ expr 56 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 56 + 1
+ cnt=57
+ '[' 57 -gt 60 ']'
+ sleep 1
++ expr 57 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 57 + 1
+ cnt=58
+ '[' 58 -gt 60 ']'
+ sleep 1
++ expr 58 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 58 + 1
+ cnt=59
+ '[' 59 -gt 60 ']'
+ sleep 1
++ expr 59 % 3
+ '[' 2 '!=' 2 ']'
+ log_action_cont_msg ''
+ echo -n ...
...+ kill -0 0000
++ expr 59 + 1
+ cnt=60
+ '[' 60 -gt 60 ']'
+ sleep 1
++ expr 60 % 3
+ '[' 0 '!=' 2 ']'
+ kill -0 0000
++ expr 60 + 1
+ cnt=61
+ '[' 61 -gt 60 ']'
+ log_action_end_msg 1 'still running'
+ local end
+ log_action_end_msg_pre 1 'still running'
+ log_end_msg_pre 1 'still running'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput setaf 2
+ GREEN=''
++ /usr/bin/tput setaf 3
+ YELLOW=''
++ /usr/bin/tput op
+ NORMAL=''
+ /usr/bin/tput civis
+ /usr/bin/tput sc
+ /usr/bin/tput hpa 0
+ '[' 1 -eq 0 ']'
+ '[' 1 -eq 255 ']'
+ /bin/echo -ne '[FAIL'
[FAIL+ /usr/bin/tput rc
+ /usr/bin/tput cnorm
+ '[' -z 'still running' ']'
+ end=' (still running).'
+ '[' 1 -eq 0 ']'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput op
+ NORMAL=''
+ /bin/echo -e 'failed (still running).'
failed (still running).
+ log_action_end_msg_post 1 'still running'
+ :
+ sleep 1
++ expr 61 % 3
+ '[' 1 '!=' 2 ']'
+ kill -0 0000
++ expr 61 + 1
+ cnt=62
+ '[' 62 -gt 60 ']'
+ log_action_end_msg 1 'still running'
+ local end
+ log_action_end_msg_pre 1 'still running'
+ log_end_msg_pre 1 'still running'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput setaf 2
+ GREEN=''
++ /usr/bin/tput setaf 3
+ YELLOW=''
++ /usr/bin/tput op
+ NORMAL=''
+ /usr/bin/tput civis
+ /usr/bin/tput sc
+ /usr/bin/tput hpa 0
+ '[' 1 -eq 0 ']'
+ '[' 1 -eq 255 ']'
+ /bin/echo -ne '[FAIL'
[FAIL+ /usr/bin/tput rc
+ /usr/bin/tput cnorm
+ '[' -z 'still running' ']'
+ end=' (still running).'
+ '[' 1 -eq 0 ']'
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput op
+ NORMAL=''
+ /bin/echo -e 'failed (still running).'
failed (still running).
(added by me: ...continues forever.)


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to