Skip to content

Instantly share code, notes, and snippets.

@kyzh
Last active February 25, 2016 19:45
Show Gist options
  • Save kyzh/1dbb91820d06d16869cb to your computer and use it in GitHub Desktop.
Save kyzh/1dbb91820d06d16869cb to your computer and use it in GitHub Desktop.
debugging RancherOS : Ctrl + C signal not working in v0.4.2 #687
dockerdaemon--log-optmax-size=25m--log-optmax-file=2-soverlay-bdocker-sys--fixed-cidr172.18.42.1/16--restart=false-g/var/lib/system-docker-Groot-Hunix:///var/run/system-docker.sock--userland-proxy=false:
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
respawn-f/etc/respawn.conf:
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
/usr/sbin/sshd-D:
IGNORED: SIGHUP
CAUGHT: SIGCHLD
CAUGHT: SIGTERM
CAUGHT: SIGQUIT
CAUGHT: SIGHUP
sshd: rancher [priv]:
IGNORED: SIGPIPE
IGNORED: SIGHUP
CAUGHT: SIGTERM
CAUGHT: SIGALRM
CAUGHT: SIGHUP
sshd: rancher@pts/0:
IGNORED: SIGHUP
CAUGHT: SIGHUP
-bash:
BLOCKED: SIGHUP
IGNORED: SIGTSTP
IGNORED: SIGQUIT
IGNORED: SIGINT
IGNORED: SIGHUP
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGXCPU
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTERM
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGILL
CAUGHT: SIGHUP
./htop-0.6.6-static:
CAUGHT: SIGPROF
CAUGHT: SIGCONT
CAUGHT: SIGALRM
CAUGHT: SIGKILL
CAUGHT: SIGHUP
/usr/bin/user-docker:
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
0.4.2
dockerdaemon--log-optmax-size=25m--log-optmax-file=2-soverlay-bdocker-sys--fixed-cidr172.18.42.1/16--restart=false-g/var/lib/system-docker-Groot-Hunix:///var/run/system-docker.sock--userland-proxy=false:
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
respawn-f/etc/respawn.conf:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
/usr/sbin/sshd-D:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
IGNORED: SIGHUP
CAUGHT: SIGCHLD
CAUGHT: SIGTERM
CAUGHT: SIGQUIT
CAUGHT: SIGHUP
sshd: rancher [priv]:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
IGNORED: SIGPIPE
IGNORED: SIGHUP
CAUGHT: SIGTERM
CAUGHT: SIGALRM
CAUGHT: SIGHUP
sshd: rancher@pts/2:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
IGNORED: SIGHUP
CAUGHT: SIGHUP
-bash:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGTERM
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
IGNORED: SIGTSTP
IGNORED: SIGQUIT
IGNORED: SIGINT
IGNORED: SIGHUP
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGXCPU
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTERM
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGILL
CAUGHT: SIGHUP
./htop-0.6.6-static:
BLOCKED: SIGSYS
BLOCKED: SIGPWR
BLOCKED: SIGPOLL
BLOCKED: SIGVTALRM
BLOCKED: SIGTTOU
BLOCKED: SIGTSTP
BLOCKED: SIGSTOP
BLOCKED: SIGCONT
BLOCKED: SIGALRM
BLOCKED: SIGUSR2
BLOCKED: SIGSEGV
BLOCKED: SIGURS1
BLOCKED: SIGKILL
BLOCKED: SIGFPE
BLOCKED: SIGBUS
BLOCKED: SIGABRT
BLOCKED: SIGILL
BLOCKED: SIGQUIT
BLOCKED: SIGINT
BLOCKED: SIGHUP
/usr/bin/user-docker:
CAUGHT:
CAUGHT: SIGSYS
CAUGHT: SIGPWR
CAUGHT: SIGPOLL
CAUGHT: SIGIO
CAUGHT: SIGPROF
CAUGHT: SIGVTALRM
CAUGHT: SIGXFSZ
CAUGHT: SIGURG
CAUGHT: SIGTTOU
CAUGHT: SIGTTIN
CAUGHT: SIGTSTP
CAUGHT: SIGSTOP
CAUGHT: SIGCONT
CAUGHT: SIGCHLD
CAUGHT: SIGTKFLT
CAUGHT: SIGURS1
CAUGHT: SIGKILL
CAUGHT: SIGFPE
CAUGHT: SIGBUS
CAUGHT: SIGABRT
CAUGHT: SIGTRAP
CAUGHT: SIGILL
CAUGHT: SIGQUIT
CAUGHT: SIGINT
CAUGHT: SIGHUP
#! /bin/bash
##
# usage: ./signals.sh <PID>
# example: ./signals.sh $(pidof respawn)
##
## implement the hex to binary we need since no bc
function h2b {
decimal=`printf "%d" \0x$1`
binary=
while [ $decimal -ne 0 ]
do
bit=$(expr $decimal % 2)
binary=$bit$binary
decimal=$(expr $decimal / 2)
done
echo $binary
}
## The list of signal's names
SIGNALSLIST=(NOSIG SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS SIGFPE SIGKILL SIGURS1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM SIGTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM SIGPROF SIGIO SIGPOLL SIGPWR SIGSYS)
## Storing the (uppercased) signals from /proc
PENDINGSTATUS=`grep SigPnd "/proc/$1/status"|cut -d $'\t' -f 2|tr '[:lower:]' '[:upper:]'`
BLOCKEDSTATUS=`grep SigBlk "/proc/$1/status"|cut -d $'\t' -f 2|tr '[:lower:]' '[:upper:]'`
IGNOREDSTATUS=`grep SigIgn "/proc/$1/status"|cut -d $'\t' -f 2|tr '[:lower:]' '[:upper:]'`
CAUGHTSTATUS=`grep SigCgt "/proc/$1/status" |cut -d $'\t' -f 2|tr '[:lower:]' '[:upper:]'`
## Storing the command name
CMD=`cat /proc/$1/cmdline`
## Removing realtime signal to keep only standard signal
PENDINGHEX=${PENDINGSTATUS: -8}
BLOCKEDHEX=${BLOCKEDSTATUS: -8}
IGNOREDHEX=${IGNOREDSTATUS: -8}
CAUGHTHEX=${CAUGHTSTATUS: -8}
## From hexadecimal to bitmap
PENDINGBITMAP=`h2b $PENDINGHEX`
BLOCKEDBITMAP=`h2b $BLOCKEDHEX`
IGNOREDBITMAP=`h2b $IGNOREDHEX`
CAUGHTBITMAP=`h2b $CAUGHTHEX`
echo ""
echo "$CMD:"
## We go through each bitmap
for bitmap in PENDINGBITMAP BLOCKEDBITMAP IGNOREDBITMAP CAUGHTBITMAP
do
## We store the value of the current bitmap
eval "bitmapvalue=\${$bitmap}"
## We store the lenght of the current bitmap string
bitmapcursor=${#bitmapvalue}
## If the content of the bitmap is empty, we stop there.
if [[ $bitmapvalue == 0 ]]; then
echo "${bitmap:0:-6} is empty";
## we skip to the next bitmap
continue
fi
## We loop trough each bit of the mask from the right
while [ $bitmapcursor -ge 1 ]
do
## The array is zero indexed, so we don't forget to -1
current_bit=${bitmapvalue:$[bitmapcursor-1]:1}
if [ $current_bit == 1 ]; then
echo "${bitmap:0:-6}: ${SIGNALSLIST[$bitmapcursor]}"
fi
bitmapcursor=$[bitmapcursor-1]
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment