Closed barp closed 5 years ago
library crashes when it fails to parse json from stdin in the child process in function child in daemon_unix.go
decoder := json.NewDecoder(os.Stdin) if err = decoder.Decode(d); err != nil { d.pidFile.Remove() return }
d.pidFile is not yet initialized at this point
it is initialized at lines below it
// create PID file after context decoding to know PID file full path. if len(d.PidFileName) > 0 { d.pidFile = NewLockFile(os.NewFile(4, d.PidFileName)) if err = d.pidFile.WritePid(); err != nil { return } }
this cause null deference
gopkg.in/sevlyar/go-daemon%2ev0.(LockFile).Remove(0x0, 0x0, 0x0) /go/pkg/mod/gopkg.in/sevlyar/go-daemon.v0@v0.1.4/lock_file.go:102 +0x2e gopkg.in/sevlyar/go-daemon%2ev0.(Context).child(0xc00007c410, 0x491dbd, 0x65ac7b) /go/pkg/mod/gopkg.in/sevlyar/go-daemon.v0@v0.1.4/daemon_unix.go:238 +0x1e0 gopkg.in/sevlyar/go-daemon%2ev0.(Context).reborn(0xc00007c410, 0x0, 0x1e, 0x1) /go/pkg/mod/gopkg.in/sevlyar/go-daemon.v0@v0.1.4/daemon_unix.go:61 +0x36 gopkg.in/sevlyar/go-daemon%2ev0.(Context).Reborn(0xc00007c410, 0x6, 0xc0000924a0, 0x1e) /go/pkg/mod/gopkg.in/sevlyar/go-daemon.v0@v0.1.4/daemon.go:31 +0x2b
library crashes when it fails to parse json from stdin in the child process in function child in daemon_unix.go
d.pidFile is not yet initialized at this point
it is initialized at lines below it
this cause null deference