kubexit icon indicating copy to clipboard operation
kubexit copied to clipboard

Stop watching SIGTERM before starting process

Open n1koo opened this issue 4 years ago • 0 comments

Fixes a problem where during start we never close the parent channel that watches for SIGTERM resulting in double signal watchers that collide with each other.

testapp-niko-bar-1603710120-hp998 bar panic: close of closed channel
testapp-niko-bar-1603710120-hp998 bar
testapp-niko-bar-1603710120-hp998 bar goroutine 17 [running]:
testapp-niko-bar-1603710120-hp998 bar main.withCancelOnSignal.func1(0xc0000a5980, 0xc0001ecf90, 0x14b9c40, 0xc00027e680)
testapp-niko-bar-1603710120-hp998 bar 	/build/cmd/kubexit/main.go:223 +0x1c6
testapp-niko-bar-1603710120-hp998 bar created by main.withCancelOnSignal
testapp-niko-bar-1603710120-hp998 bar 	/build/cmd/kubexit/main.go:211 +0xe1

parentCancel() is safe to call (no double cancel) when coming out of pod watching due to the fact we now bail out with os.Exit(0 on line 219 rather than starting the app and skipping watches.

n1koo avatar Oct 26 '20 12:10 n1koo