Queue skips Closing after delete-and-recreate while its PodGroups are still running
Description
Observed in a live cluster (kind, Volcano master @ 606c628d364db8de18c045e947d5255ef058aa26, admission webhooks enabled with chart defaults).
A queue that is deleted and then recreated under the same name while its PodGroups are still running reports Closed immediately when a close action is issued, even though the queue still has running PodGroups and running pods. The expected transition is Closing first, and Closed only after every PodGroup under the queue is gone. See the state handlers (state/open.go, state/closing.go) and the queue state design doc.
Deleting a queue while it still has allocated workloads is permitted by design (see #2068; the allocated-pods deletion guard is behind EnableQueueAllocatedPodsCheck, which defaults to off). A recreated queue should therefore observe its existing PodGroups again.
Impact: with the queue in Closed, new jobs are rejected by the admission webhook (can only submit job to queue with state 'Open') while the previous workload keeps running and consuming resources. The state does not self-heal: it stayed Closed for 90+ seconds in a dedicated observation and for about 10 minutes in the first reproduction, while the PodGroups remained Running and the scheduler kept updating the queue's allocated resources normally. Recovery only happens through an explicit open action or a PodGroup phase change.
Relation to the open PR #5955: that fix targets the resync branch of closedState.Execute (a queue already in Closed with a non-empty PodGroup list stays Closed). This report is a different entry point: the close action itself observes an empty PodGroup list because the queue controller's in-memory cache was dropped, so the queue skips Closing entirely. #5955 would not change this behavior.
Steps to reproduce the issue
The premature Closed transition reproduces with admission enabled or disabled; the job-rejection observation in step 6 requires admission enabled (chart default). All steps below run against a default install.
- Create the queue and a namespace:
apiVersion: scheduling.volcano.sh/v1beta1
kind: Queue
metadata:
name: q
spec:
parent: root
weight: 1
- Deploy a 2-replica workload pinned to the queue:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: qns
annotations:
scheduling.volcano.sh/queue-name: q
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
annotations:
scheduling.volcano.sh/queue-name: q
labels:
app: web
spec:
schedulerName: volcano
containers:
- name: c
image: registry.k8s.io/pause:3.10
resources:
requests:
cpu: 500m
Wait until the PodGroup is Running and both pods are Running.
- Delete the queue while the PodGroup is still running:
kubectl delete queue q
The PodGroup remains and the pods keep running.
- Recreate the queue with the same name (e.g. to adjust
weightorcapability):
apiVersion: scheduling.volcano.sh/v1beta1
kind: Queue
metadata:
name: q
spec:
parent: root
weight: 1
- Close the queue by creating a Command targeting it (equivalent to
vcctl queue operate --action close --name q):
apiVersion: bus.volcano.sh/v1alpha1
kind: Command
metadata:
generateName: q-close-
namespace: default
target:
apiVersion: scheduling.volcano.sh/v1beta1
kind: Queue
name: q
action: CloseQueue
Actual: the queue reports Closed immediately. Expected: Closing while the PodGroup is still running.
- (Optional, admission enabled) Submit a new job to queue
q: it is rejected byvalidatejob.volcano.sheven though the previous workload is still running.
Evidence and production path
Reproduced twice on a live cluster (queues real-b and real-x), plus a clean control run without steps 3–4, which transitions correctly to Closing.
Reproduction (queue real-x, after step 5):
$ kubectl get queue real-x -o jsonpath='{.status.state}'
Closed
$ kubectl get podgroup -n real-x
NAME STATUS MINMEMBER RUNNINGS AGE QUEUE
podgroup-8e467568-a2a9-4d2c-82db-cc68672cf753 Running 1 2 6m real-x
$ kubectl get pods -n real-x
NAME READY STATUS RESTARTS AGE
web-x-585c975fb5-5drj5 1/1 Running 0 6m
web-x-585c975fb5-p2klt 1/1 Running 0 6m
Job submission while in this state (admission enabled):
$ kubectl create -f job.yaml
Error from server: admission webhook "validatejob.volcano.sh" denied the request:
can only submit job to queue with state `Open`, queue `real-x` status is `Closed`;
Control (queue real-y, same workload, no delete/recreate):
$ kubectl get queue real-y -o jsonpath='{.status.state}'
Closing
The Closed state persisted for 90 seconds of polling in the dedicated observation and for about 10 minutes in the first reproduction (real-b), with no PodGroup event in between. During that window the scheduler kept running and kept updating the queue's allocated resources normally, so this is not an event-delay artifact.
After step 4 (recreate), the scheduler re-adopts the queue's workload within seconds; the queue reports allocated CPU and pods again. The name-based association between the recreated queue and the existing PodGroup works everywhere except the queue controller's state machine.
Root cause (code inspection at master @ 606c628d364db8de18c045e947d5255ef058aa26):
The queue controller keeps an in-memory map of PodGroups per queue, populated only by PodGroup informer events:
- addPodGroup fills c.podGroups[queue]
- deleteQueue drops the whole map entry for the queue
- addQueue only enqueues a sync; it does not rebuild the map from the PodGroup lister
syncQueue only removes entries that no longer exist in the lister; it never adds missing ones, and the state transition consumes the in-memory list. So after delete + recreate the map is empty while real PodGroups still exist, and a close action sees len(podGroupList) == 0 and writes Closed:
The documented transition through Closing, with Closed only after the queue's PodGroups are gone, is described in the queue state management design.
The controller heals only on a PodGroup phase change (which re-populates the map) or on controller restart (informer full resync replays add events).
Related work in the same area:
- #5955 (open PR): same symptom family, different entry point. See the note in Description.
- #5734 and #5325: other informer-event lifecycle gaps in the same controllers.
- #2068: context for why deleting an
Openqueue is currently allowed by design.
Describe the results you received and expected
Actual: after delete + recreate, close reports Closed immediately while the queue still has running PodGroups and pods; new jobs are rejected; the state persists until an explicit open or a PodGroup phase change.
Expected: close on a queue that still has running PodGroups transitions to Closing and reports Closed only after the PodGroups disappear; a recreated queue sees its existing PodGroups again.
What version of Volcano are you using?
master @ 606c628d364db8de18c045e947d5255ef058aa26 (2026-09-08), images built from that commit, installed with helm chart volcano-1.15.0.
Any other relevant information
- Kubernetes v1.37.0 (kind cluster), Linux. Admission webhooks enabled with chart defaults; scheduler config at chart defaults (
actions: enqueue, allocate, backfill). - The close action uses the Command CR (
bus.volcano.sh/v1alpha1) behind theQueueCommandSyncfeature gate (default true), the same path asvcctl queue operate. - Fix direction (for discussion): rebuild the queue's PodGroup map from the PodGroup lister when a queue is added or synced, symmetrically with the existing stale-entry cleanup. Happy to prepare a PR with a regression test.
- Drafted with AI assistance (writing and analysis support); all reproductions, evidence, and code paths were verified manually in a live cluster.
/assign