Repository navigation
Conversation
Store entries were only removed by GC, the create rollback and the session DELETE API. When a Sandbox or SandboxClaim was deleted any other way, such as kubectl delete or a CodeInterpreter deletion cascading to its claims, the session stayed in the store. The Router kept proxying to the old pod and returned 502/503/504 instead of 404 SESSION_NOT_FOUND, and each retry refreshed last activity, so idle GC never picked the entry up. Watch Sandbox and SandboxClaim deletions and remove the session named by the session-id label, but only when the stored entry still points at the deleted object. Signed-off-by: GuTS805 <alok020505@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #496 +/- ##
==========================================
+ Coverage 60.45% 61.74% +1.29%
==========================================
Files 35 35
Lines 3616 3691 +75
==========================================
+ Hits 2186 2279 +93
+ Misses 1211 1186 -25
- Partials 219 226 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
generally LG |
|
Thanks! LMK if anything needs changing. |
|
Hi @GuTS805, thanks for working on this. The session endpoint may also become stale when:
In these cases, the session record may still contain the old Pod IP. Should we handle these cases in this PR as well? |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When a Sandbox or SandboxClaim is deleted by anything other than GC or the session DELETE API (e.g.
kubectl delete sandbox, or deleting a warm-pool CodeInterpreter), its session stays in the store. The Router keeps proxying to the old pod and returns 502/503/504 instead of404 SESSION_NOT_FOUND, and every retry refreshes last activity, so idle GC never removes it.This PR watches Sandbox and SandboxClaim deletions in the workload manager and removes the session named by the
runtime.agentcube.io/session-idlabel. The entry is only removed if its kind, namespace and name still match the deleted object.Which issue(s) this PR fixes:
Fixes #469
Special notes for your reviewer:
kubectl delete sandbox, the key stayed in Redis, the Router returned 504, and the last-activity score kept moving. After: 404SESSION_NOT_FOUNDand the key is removed. Deleting a warm-pool CodeInterpreter also removes its claim's session.go test -race ./pkg/workloadmanager/, golangci-lint and the e2e suite pass locally.Does this PR introduce a user-facing change?: