fleetd: check that eStream is available before accessing to that#1623
Conversation
Print "Server register machine failed" as warning instead of error, to avoid getting users confused by the message that it would look like a critical error.
To avoid potential nil-dereferences in agent reconciliation, check
that eStream is available before accessing to eStream. Otherwise,
just return.
Example error logs:
====
ERROR server.go:192: Server register machine failed: 105: Key already exists
(/_coreos.com/fleet/machines/d5ca2e9d4039e480807464280c9ab4a2/object) [203153266]
INFO server.go:188: hrt.Register() success
INFO server.go:198: Starting server components
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x4bc024]
goroutine 49 [running]:
panic(0xc06080, 0xc82000a0a0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/coreos/fleet/pkg.(*reconciler).Run.func1(0xc8201cef00, 0xc8201b9560, 0xc8201cf2c0)
/opt/fleet/gopath/src/github.com/coreos/fleet/pkg/reconcile.go:65 +0x74
created by github.com/coreos/fleet/pkg.(*reconciler).Run
/opt/fleet/gopath/src/github.com/coreos/fleet/pkg/reconcile.go:69 +0x89
systemd[1]: fleet.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: fleet.service: Unit entered failed state.
systemd[1]: fleet.service: Failed with result 'exit-code'.
====
Fixes: coreos#1622
aa6b7df to
f591070
Compare
|
when would this ever be nil? Isn't that a bug in other code? |
|
@jonboulle |
|
I do have |
|
This is the config of one of my machines (only METADATA differs per machines) |
@ewoutp Aha. Then it makes sense. Hopefully this PR could fix the bug in your case. Thanks! |
|
Merged. Thanks. |
To avoid potential nil-dereferences in agent reconciliation, check that eStream is available before accessing to
eStream. Otherwise, just return.Example error logs:
Fixes: #1622