flatcar / flatcar-linux-update-operator

A Kubernetes operator to manage updates of Flatcar Container Linux
Apache License 2.0
102 stars 19 forks source link

pkg/updateengine: ReceiveStatuses() may get nil signal on shutdown and panic #101

Open invidian opened 2 years ago

invidian commented 2 years ago

Originally reported here: https://github.com/coreos/bugs/issues/1987

However, https://github.com/coreos/locksmith/pull/137/commits/8b0a62ef420c80cee39c3de77daeb7bf7c5bf81c doesn't seem like a correct fix for it, as you can avoid getting nil signal completely, if you wait for receiver loop to shut down, e.g. by waiting for the final nil value from given ch on the process spawning ReceiveStatuses() goroutine.

Also related: https://github.com/godbus/dbus/issues/271

invidian commented 2 years ago

Actually, this does not affect agent, as it always drains the receive channel, but it's important to notice when consuming pkg/updateengine directly, so we should have unit tests for this.

invidian commented 2 years ago

This also happens when you close the client before stopping the receiver routine, so clearly a bug.