Open aequitas opened 6 years ago
@aequitas I'll be honest: our lib/main.go is a bit terrible, and needs some rewriting...
@purpleidea yea, I started a short debug session but figured it would take a bit more time :D But is doesn't look that bad from a distance :)
So this is just the recording of my investigation for when I (or anyone else) wants to pick this up.
@aequitas A have a fairly decent dependency graph in my head of what needs to happen in what order in terms of most efficiently solving all of the problems, but it's sadly not documented anywhere. This is most definitely an issue. It will get much easier to fix once https://github.com/purpleidea/mgmt/issues/277 is fixed, and also once my embedded etcd rewrite lands.
Thank you for the report!
@purpleidea Cool, when I have my initial setup running I'll resync on this with you and see what I can do :)
lib.Main:Exit sends to a channel: https://github.com/purpleidea/mgmt/blob/9ba893c06c1058f39ac1e1ed7791d8386fd70065/lib/main.go#L199-L201
that will not be listened to until Main is 'running': https://github.com/purpleidea/mgmt/blob/9ba893c06c1058f39ac1e1ed7791d8386fd70065/lib/main.go#L807
At several points that causes mgmt to get 'stuck'. For example while connecting to to an unreachable seed[0] and interrupting with ctrl-c: https://github.com/purpleidea/mgmt/blob/9ba893c06c1058f39ac1e1ed7791d8386fd70065/lib/cli.go#L155
Or when the embedded etcd server fails to start: https://github.com/purpleidea/mgmt/blob/9ba893c06c1058f39ac1e1ed7791d8386fd70065/lib/main.go#L352
My golang knowledge about channels is not that deep yet, so my assumptions might be wrong.
[0]