Skip to content

Commit

Permalink
Ignoring SIGURG in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin Meyer authored and jvasallo committed Apr 8, 2021
1 parent 69df4da commit e8c1f0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ func main() {
go func() {

for sig := range stop {
if proc == nil {
if sig == syscall.SIGURG {
// SIGURG is used by Golang for it's own purposes, ignore it as these signals
// are most likely "junk" from Golang not from K8s/Docker
log(fmt.Sprintf("Received signal '%v', ignoring", sig))
} else if proc == nil {
// Signal received before the process even started. Let's just exit.
log(fmt.Sprintf("Received signal '%v', exiting", sig))
kill(1) // Attempt to stop sidecars if configured
Expand Down
7 changes: 6 additions & 1 deletion scripts/self_destruct.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
# Helpful when testing signal handling
# use:
# ./scuttle /bin/bash scripts/self_destruct.sh
kill -INT $(pidof scuttle)
scuttle_pid=$(pidof scuttle)
echo "------ Sending SIGURG, should be ignored ------ "
kill -URG $scuttle_pid
echo "------ Sending SIGINT, Scuttle should pass to child, child should exit, scuttle should exit ------ "
kill -INT $scuttle_pid
# Print "." until process ends
while 1>0; do echo -n "." && sleep 1; done;

0 comments on commit e8c1f0e

Please sign in to comment.