Skip to content

[Bug] Drop pool policy activity records of pods that stopped reporting - #2885

Merged
varungup90 merged 1 commit into
vllm-project:mainfrom
ankit373:fix/pool-policy-drop-stale-activity-2883
Oct 1, 2026
Merged

varungup90 merged 1 commit into
vllm-project:mainfrom
ankit373:fix/pool-policy-drop-stale-activity-2883

Conversation

@ankit373

@ankit373 ankit373 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

Problem. poolPolicyManager.activity gets a record for every pod and engine the pool policy observes, and nothing removes it. Every replaced pod leaves records behind until the controller restarts.

Root cause. observe only adds and updates entries. Nothing in pool_policy_controller.go deletes them.

Fix. Each record now carries the time it was last observed. begin, which runs once per pool per cycle, sweeps records unseen for 5 minutes. The sweep scans the whole map, so it runs at most once a minute, which keeps the cost at one pass over the records per minute no matter how many pools run. A live pod is observed every 10 seconds (DefaultRequeueDuration), so it never ages out.

A model that is asleep is not observed, so its record can age out too. When it wakes up it starts from a fresh baseline and its decisions wait for the next snapshot, which is what a controller restart already does (see the comment on poolPolicyManager).

Tests.

  • TestPoolPolicyManagerDropsActivityOfPodsThatStopReporting: a replaced pod's record stays inside the window and is gone after it, the new pod's record stays
  • TestPoolPolicyManagerKeepsTheBaselineOfAnObservedPod: a pod observed every interval for 5 minutes keeps its counter baseline and still reports the right delta
  • TestPoolPolicyManagerSweepsAtMostOncePerInterval: a sweep inside the interval is skipped

Checks run:

  • go test -race ./pkg/controller/modelclaim/ passes. On macOS I used -ldflags=-linkmode=external to avoid a missing LC_UUID abort.
  • golangci-lint run ./pkg/controller/modelclaim/... reports 0 issues.

Related Issues

Resolves: #2883

Records were added by observe and never removed, so the map grew with every replaced pod until the controller restarted. Stamp each record with the time it was last observed and sweep the ones unseen for five minutes, at most once a minute.

Signed-off-by: Ankit Jha <[email protected]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to clean up stale activity records of pods that have stopped reporting in the poolPolicyManager. It tracks the last seen time for each activity record and periodically sweeps the activity map to remove records older than 5 minutes, bounded to run at most once per minute. Comprehensive unit tests are also added to verify this behavior. I have no feedback to provide.

@varungup90 varungup90 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the activity retention/sweep changes and their interaction with pool reconciliation, request-counter baselines, KV allocation, and idle-sleep decisions. No actionable issues found.

The sweep and observation updates use the same mutex; the sweep timestamp is manager-wide, so multiple pools share the scan throttle. Expiry deliberately discards an unobserved baseline, and the next observation reinitializes it without treating historical completions as new activity.

Validation at this commit:

  • go test ./pkg/controller/modelclaim/ -count=1 passed.
  • go test -race -ldflags=-linkmode=external ./pkg/controller/modelclaim/ -count=1 passed.
  • An additional temporary test in an isolated worktree passed under the race detector, covering the retention boundary, global sweep throttling across two pools, baseline reinitialization after expiry, and subsequent completion deltas. The temporary test was removed after validation.
  • git diff --check passed.

Cluster/envtest integration tests were not run.

@varungup90
varungup90 merged commit 139bacf into vllm-project:main Oct 1, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][ModelClaim] The pool policy never drops the activity records of pods that are gone

2 participants