From 566164a321afb2109b5f8a87bcc534d8d40aa2df Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Thu, 2 Oct 2025 12:24:59 -0400 Subject: [PATCH] state: nil-check waiting evals before attempting to cancel them (#26872) When we attempt to drop unneeded evals from the eval broker, if the eval has been GC'd before the check is made, we hit a nil pointer. Check that the eval actually exists before attempting to remove it from the broker. Fixes: https://github.com/hashicorp/nomad/issues/26871 --- .changelog/26872.txt | 3 +++ nomad/fsm.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changelog/26872.txt diff --git a/.changelog/26872.txt b/.changelog/26872.txt new file mode 100644 index 000000000..3a5163435 --- /dev/null +++ b/.changelog/26872.txt @@ -0,0 +1,3 @@ +```release-note:bug +state: Fixed a bug where the server could panic when attempting to remove unneeded evals from the eval broker +``` diff --git a/nomad/fsm.go b/nomad/fsm.go index c760b5caf..89b813c98 100644 --- a/nomad/fsm.go +++ b/nomad/fsm.go @@ -1034,7 +1034,7 @@ func (n *nomadFSM) applyAllocClientUpdate(msgType structs.MessageType, buf []byt "eval_id", evalID, "error", err) return err } - if !eval.ShouldEnqueue() { + if eval != nil && !eval.ShouldEnqueue() { n.evalBroker.DropWaiting(eval) } }