open-nomad/nomad/structs
Mahmood Ali 1de395b42c
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
..
config chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
batch_future.go drain: refactor batch_future into its own file 2018-04-02 16:40:06 -07:00
batch_future_test.go drain: refactor batch_future into its own file 2018-04-02 16:40:06 -07:00
bitmap.go assign names 2017-07-07 12:03:11 -07:00
bitmap_test.go assign names 2017-07-07 12:03:11 -07:00
connect.go e2e: consul namespace tests from nomad ent 2021-04-19 15:35:31 -06:00
connect_test.go consul/connect: add support for connect mesh gateways 2021-06-04 08:24:49 -05:00
consul.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
consul_oss.go gofmt all the files 2021-10-01 10:14:28 -04:00
consul_oss_test.go gofmt all the files 2021-10-01 10:14:28 -04:00
consul_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
csi.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
csi_test.go CSI: use AccessMode/AttachmentMode from CSIVolumeClaim 2021-04-07 11:24:09 -04:00
devices.go Initial implementation of device preemption 2018-11-15 11:09:26 -06:00
devices_test.go Split device accounter and allocator 2018-11-07 10:32:03 -08:00
diff.go Fixed plan diffing to handle non-unique service names. (#10965) 2021-10-12 16:42:39 -04:00
diff_test.go Fixed plan diffing to handle non-unique service names. (#10965) 2021-10-12 16:42:39 -04:00
encoding.go json handles were moved to a new package in #10202 2021-04-02 13:31:10 +00:00
errors.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
errors_test.go api: acl bootstrap errors aren't 500 2019-11-19 15:51:57 -05:00
event.go docs: fix typo in structs/event.go 2021-08-21 17:02:07 +05:30
extensions.go json handles were moved to a new package in #10202 2021-04-02 13:31:10 +00:00
funcs.go Fix preemption panic (#11346) 2021-10-19 20:22:03 -04:00
funcs_test.go oversubscription: Add MemoryMaxMB to internal structs 2021-03-30 16:55:58 -04:00
generate.sh When serializing msgpack, only consider codec tag 2020-05-11 14:14:10 -04:00
handlers.go json handles were moved to a new package in #10202 2021-04-02 13:31:10 +00:00
network.go client: improve errors & tests for dynamic ports 2021-10-13 16:25:25 -07:00
network_test.go Support configurable dynamic port range 2021-09-10 11:52:47 +03:00
node.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
node_class.go use allow/deny instead of the colored alternatives (#9019) 2020-10-12 08:47:05 -04:00
node_class_test.go Device hook and devices affect computed node class 2018-11-27 17:25:33 -08:00
node_test.go fix issue when updating node events 2018-03-21 15:15:26 -04:00
operator.go core: implement system batch scheduler 2021-08-03 10:30:47 -04:00
search.go api: implement fuzzy search API 2021-04-16 16:36:07 -06:00
service_identities.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
services.go connect: update allowed protocols in ingress gateway config (#11187) 2021-09-16 10:47:53 -04:00
services_test.go connect: update allowed protocols in ingress gateway config (#11187) 2021-09-16 10:47:53 -04:00
streaming_rpc.go Fix some errcheck errors (#9811) 2021-01-14 12:46:35 -08:00
structs.go Merge pull request #11167 from a-zagaevskiy/master 2021-10-13 16:47:38 -07:00
structs_codegen.go Codecgen full package 2018-04-26 15:24:53 -07:00
structs_oss.go gofmt all the files 2021-10-01 10:14:28 -04:00
structs_periodic_test.go tests for periodic job scheduling and DST 2020-05-07 17:36:59 -04:00
structs_test.go gofmt all the files 2021-10-01 10:14:28 -04:00
testing.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
volumes.go csi: validate `volume` block has `attachment_mode` and `access_mode` 2021-06-03 16:07:19 -04:00