Files
nomad/scheduler
Mahmood Ali 6d35e2fb58 Fix preemption panic (#11346)
Fix a bug where the scheduler may panic when preemption is enabled. The conditions are a bit complicated:
A job with higher priority that schedule multiple allocations that preempt other multiple allocations on the same node, due to port/network/device assignments.

The cause of the bug is incidental mutation of internal cached data. `RankedNode` computes and cache proposed allocations  in https://github.com/hashicorp/nomad/blob/v1.1.6/scheduler/rank.go#L42-L53 . But scheduler then mutates the list to remove pre-emptable allocs in https://github.com/hashicorp/nomad/blob/v1.1.6/scheduler/rank.go#L293-L294, and  `RemoveAllocs` mutates and sets the tail of cached slice with `nil`s triggering a nil-pointer derefencing case.

I fixed the issue by avoiding the mutation in `RemoveAllocs` - the micro-optimization there doesn't seem necessary.

Fixes https://github.com/hashicorp/nomad/issues/11342
2021-10-19 20:22:03 -04:00
..
2018-12-06 15:09:26 -08:00
2020-10-19 09:30:15 -04:00
2021-10-01 10:14:28 -04:00
2018-09-15 16:23:13 -07:00
2021-10-01 10:14:28 -04:00
2021-10-01 10:14:28 -04:00
2020-10-19 09:30:15 -04:00
2021-10-01 10:14:28 -04:00
2021-10-01 10:14:28 -04:00