karimra / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.kmrd.dev
Apache License 2.0
217 stars 32 forks source link

nil pointer deref in `listen` #594

Open hellt opened 2 years ago

hellt commented 2 years ago

reported by @aturnal running 0.24.4

gnmic listen -a 0.0.0.0:57500 --insecure --debug
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x22fd501]

goroutine 1 [running]:
os.(*File).Name(...)
/opt/hostedtoolcache/go/1.17.2/x64/src/os/file.go:57
github.com/karimra/gnmic/outputs/file.(*File).Close(0xc0005e3f40)
/home/runner/work/gnmic/gnmic/outputs/file/file_output.go:256 +0x21
github.com/karimra/gnmic/cmd.newListenCmd.func2.1()
/home/runner/work/gnmic/gnmic/cmd/listen.go:106 +0x5d
github.com/karimra/gnmic/cmd.newListenCmd.func2(0xc00063f900, {0xc00087ef40, 0x4, 0x4})
/home/runner/work/gnmic/gnmic/cmd/listen.go:111 +0x1289
github.com/spf13/cobra.(*Command).execute(0xc00063f900, {0xc00087ef00, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc00063ea00)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/karimra/gnmic/cmd.Execute()
/home/runner/work/gnmic/gnmic/cmd/root.go:87 +0x2f
main.main()
/home/runner/work/gnmic/gnmic/main.go:22 +0x17

happened on a VM, was not reproducible on a server.

karimra commented 2 years ago

Does this happen when the command is stopped with Ctrl+C ? any config file in PWD or HOME ? anymore log output ?