Fix log panic if server refuses connection
Closed this issue · 0 comments
MargoTuleninova commented
To Reproduce
chkit logs pandora-hagen-786bcb6f75-xhkz7 thisbe
!!!!!!!!!!!!!!!!!!!!!!!!
websocket: bad handshake
!!!!!!!!!!!!!!!!!!!!!!!!
panic: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a6922]
goroutine 1 [running]:
io.(*PipeReader).CloseWithError(0x0, 0x0, 0x0, 0xc420000100, 0xc4204cf4c0)
/usr/lib/go-1.10/src/io/pipe.go:139 +0x42
io.(*PipeReader).Close(0x0, 0x0, 0x0)
/usr/lib/go-1.10/src/io/pipe.go:133 +0x41
panic(0xc22e60, 0x108d140)
/usr/lib/go-1.10/src/runtime/panic.go:502 +0x24a
io.(*PipeReader).Read(0x0, 0xc4200ea000, 0x1000, 0x1000, 0x0, 0x0, 0x1)
/usr/lib/go-1.10/src/io/pipe.go:127 +0x42
bufio.(*Scanner).Scan(0xc4204cf910, 0x80)
/usr/lib/go-1.10/src/bufio/scan.go:208 +0x1ae
github.com/containerum/chkit/pkg/cli.Logs.func2(0xc420425680, 0xc42041ff60, 0x2, 0x2)
/home/margo/go/src/github.com/containerum/chkit/pkg/cli/logs.go:80 +0x4b2
github.com/containerum/chkit/vendor/github.com/spf13/cobra.(*Command).execute(0xc420425680, 0xc4200a8060, 0x2, 0x2, 0xc420425680, 0xc4200a8060)
/home/margo/go/src/github.com/containerum/chkit/vendor/github.com/spf13/cobra/command.go:766 +0x85c
github.com/containerum/chkit/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc420309b80, 0xb35860, 0xc42042b800, 0xc)
/home/margo/go/src/github.com/containerum/chkit/vendor/github.com/spf13/cobra/command.go:852 +0x4a9
github.com/containerum/chkit/vendor/github.com/spf13/cobra.(*Command).Execute(0xc420309b80, 0xc42017bea0, 0xc)
/home/margo/go/src/github.com/containerum/chkit/vendor/github.com/spf13/cobra/command.go:800 +0x39
github.com/containerum/chkit/pkg/cli.Root(0x455ac0, 0x4294e4)
/home/margo/go/src/github.com/containerum/chkit/pkg/cli/root.go:93 +0xbee
main.main()
/home/margo/go/src/github.com/containerum/chkit/cmd/chkit/chkit.go:19 +0x34