sector-f / failoverd

Scriptable daemon for updating routes based on packet loss to endpoints
MIT License
1 stars 0 forks source link

Look into race condition(?) that's occurring on quit #4

Closed sector-f closed 1 year ago

sector-f commented 1 year ago

Very rarely, pressing ^C seems to make the program hang indefinitely rather than quit properly. This indicates that there is probably some kind of race condition somewhere.

I could just work around this by adding a timeout that causes the program to call os.Exit if it hasn't shut down e.g. 3 seconds after SIGINT has been received, but I'd rather figure out the actual issue and fix that.

sector-f commented 1 year ago

Should be fixed by 096a9bd546127235ae9175e6c6ebc901df9853f8, but I'm gonna leave this open for now just in case I'm wrong

sector-f commented 1 year ago

Should still remain fixed in f49498d173bcae8712452f6efe918e64f4250c07 but with cleaner code

sector-f commented 1 year ago

To elaborate on the issue: the code was reaching a point where a probe was trying to send over the stats channel when the main pinger thread was at a point where it was trying to send over a stop channel (and therefore neither action would ever succeed)

In other words: deadlock