004fa574cb
Similar to previous commits the delayed eval update chan was set and access from different goroutines causing a race. Passing the chan on the stack resolves the race. Race output from `go test -race -run 'Server_RPC$'` in nomad/ ``` ================== WARNING: DATA RACE Write at 0x00c000339150 by goroutine 63: github.com/hashicorp/nomad/nomad.(*EvalBroker).flush() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/eval_broker.go:708 +0x3dc github.com/hashicorp/nomad/nomad.(*EvalBroker).SetEnabled() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/eval_broker.go:174 +0xc4 github.com/hashicorp/nomad/nomad.(*Server).revokeLeadership() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:718 +0x1fd github.com/hashicorp/nomad/nomad.(*Server).leaderLoop() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:122 +0x95d github.com/hashicorp/nomad/nomad.(*Server).monitorLeadership.func1() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:72 +0x6c Previous read at 0x00c000339150 by goroutine 73: github.com/hashicorp/nomad/nomad.(*EvalBroker).runDelayedEvalsWatcher() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/eval_broker.go:771 +0x176 Goroutine 63 (running) created at: github.com/hashicorp/nomad/nomad.(*Server).monitorLeadership() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:70 +0x269 Goroutine 73 (running) created at: github.com/hashicorp/nomad/nomad.(*EvalBroker).SetEnabled() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/eval_broker.go:170 +0x173 github.com/hashicorp/nomad/nomad.(*Server).establishLeadership() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:207 +0x355 github.com/hashicorp/nomad/nomad.(*Server).leaderLoop() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:117 +0x82e github.com/hashicorp/nomad/nomad.(*Server).monitorLeadership.func1() /home/schmichael/go/src/github.com/hashicorp/nomad/nomad/leader.go:72 +0x6c ================== ``` |
||
---|---|---|
.. | ||
deploymentwatcher | ||
drainer | ||
mock | ||
state | ||
structs | ||
types | ||
acl.go | ||
acl_endpoint.go | ||
acl_endpoint_test.go | ||
acl_test.go | ||
alloc_endpoint.go | ||
alloc_endpoint_test.go | ||
autopilot.go | ||
autopilot_test.go | ||
blocked_evals.go | ||
blocked_evals_test.go | ||
client_alloc_endpoint.go | ||
client_alloc_endpoint_test.go | ||
client_fs_endpoint.go | ||
client_fs_endpoint_test.go | ||
client_rpc.go | ||
client_rpc_test.go | ||
client_stats_endpoint.go | ||
client_stats_endpoint_test.go | ||
config.go | ||
core_sched.go | ||
core_sched_test.go | ||
deployment_endpoint.go | ||
deployment_endpoint_test.go | ||
deployment_watcher_shims.go | ||
drainer_int_test.go | ||
drainer_shims.go | ||
endpoints_oss.go | ||
eval_broker.go | ||
eval_broker_test.go | ||
eval_endpoint.go | ||
eval_endpoint_test.go | ||
fsm.go | ||
fsm_not_ent.go | ||
fsm_registry_oss.go | ||
fsm_test.go | ||
heartbeat.go | ||
heartbeat_test.go | ||
job_endpoint.go | ||
job_endpoint_oss.go | ||
job_endpoint_test.go | ||
leader.go | ||
leader_oss.go | ||
leader_test.go | ||
merge.go | ||
node_endpoint.go | ||
node_endpoint_test.go | ||
operator_endpoint.go | ||
operator_endpoint_test.go | ||
periodic.go | ||
periodic_endpoint.go | ||
periodic_endpoint_test.go | ||
periodic_test.go | ||
plan_apply.go | ||
plan_apply_not_ent.go | ||
plan_apply_pool.go | ||
plan_apply_pool_test.go | ||
plan_apply_test.go | ||
plan_endpoint.go | ||
plan_endpoint_test.go | ||
plan_queue.go | ||
plan_queue_test.go | ||
raft_rpc.go | ||
regions_endpoint.go | ||
regions_endpoint_test.go | ||
rpc.go | ||
rpc_test.go | ||
search_endpoint.go | ||
search_endpoint_oss.go | ||
search_endpoint_test.go | ||
serf.go | ||
serf_test.go | ||
server.go | ||
server_setup_oss.go | ||
server_test.go | ||
stats_fetcher.go | ||
stats_fetcher_test.go | ||
status_endpoint.go | ||
status_endpoint_test.go | ||
system_endpoint.go | ||
system_endpoint_test.go | ||
testing.go | ||
timetable.go | ||
timetable_test.go | ||
util.go | ||
util_test.go | ||
vault.go | ||
vault_test.go | ||
vault_testing.go | ||
worker.go | ||
worker_test.go |