The order of booting up a server should be Job scheduler -> Cluster. And shutdown should be the opposite. This is needed because the job scheduler initializes certain data structures that are later called by ClusterLeaderChanged event handlers. And the event handlers run in a separate goroutine. Therefore, if the cluster initialization happens before the job scheduler, then a race happens between accessing the jobs variable and setting it. To prevent this race, we fix the order of startup, and add comments in both places to prevent things from regressing again.
1.3 KiB
1.3 KiB