Repository navigation
Conversation
CleanupAll and CleanupStaleLocks released the flock before removing the lock path, leaving the same unlock/unlink race that ReleaseTrackedLock avoids: a waiter could flock the about-to-be-removed inode, then have the pathname yanked out from under it while another process locks a fresh replacement inode — two processes holding "the" lock. Reorder both to remove the path first, so any subsequent open necessarily gets a new inode and AcquireTrackedLock's identity check can detect the stale one. CleanupStaleLocks deliberately keeps TryLock (non-blocking, on an already-stale-by-age file) instead of routing through the retrying acquire path. Fixes: stacklok#6713
Add the Pi coding agent (pi.dev) to the supported MCP clients for thv client register/setup and the desktop app's Manage Clients dialog. Pi reads servers from a standard mcpServers JSON file at ~/.pi/agent/mcp.json, so it fits the existing client model with no new config logic. stdio and streamable-http transports are supported; SSE is intentionally omitted because Pi rejects "type": "sse". Fixes stacklok#6735
--oidc-insecure-allow-http, --thv-ca-bundle, and --jwks-auth-token-file were accepted but discarded: createOIDCConfig never set InsecureAllowHTTP, CACertPath, or AuthTokenFile on the TokenValidatorConfig. Wire them through from runFlags so the CLI matches the runner config builder.
MultiSession Terminate deleted the storage record but left the node-local cache entry in place; backend connections stayed open until a subsequent Get triggered lazy eviction. Under sustained create/terminate churn the cache never shrank, accumulating ~2.3MiB per terminated session until the pod OOM-killed. Add ValidatingCache.Remove (same lock discipline as RemoveMatching: remove under mu, run onEvict off the lock) and call it from Terminate's Phase 2 branch right after the storage delete, so onEvict closes the backend connections immediately instead of on the next request. fixes stacklok#6762
|
@suantea I had already volunteered to implement this fix and requested assignment in #6762 before this PR was opened. This is a problem we are currently experiencing in production. I was waiting for assignment in accordance with the [contribution guide], and planned to coordinate the scope with the maintainers, implement the fix, and validate it against our actual workload. Since I had already expressed my intent to work on this, I would have appreciated coordinating before implementation. I also noticed that the current diff includes unrelated lockfile, Pi client, and OIDC flag changes alongside the #6762 fix. These should be separated to keep the PR focused. @alex-feel, since you suggested coordinating this with #5860, could you help clarify the next step for that coordination? I'd like to align with the maintainers on how to proceed, and I'm still happy to take on the implementation and validation as originally proposed. |
|
@suantea, we’ve assigned #6762 to @hellouz818 following their earlier request. Coordination details are here: #6762 (comment). Could you two agree whether to continue together on this PR or carry the focused fix into a replacement? Either way, let’s preserve credit for the existing work and keep the unrelated changes separate. |
|
@JAORMX, thanks for assigning #6762 to me and clarifying the scope. @suantea, thanks for taking the time to put together a patch. I had already implemented the fix locally and was waiting for assignment before opening a PR, in accordance with the contribution guide. I'd like to open a focused PR with my existing implementation and regression tests, and validate the fix against the production workload where we observed this issue. I'll keep the scope limited to explicit termination, as agreed. Would you both be comfortable with proceeding this way? Thanks for helping coordinate this. |
|
Hi @suantea, I'm closing this PR along with the rest of this batch. Nothing personal, it's just not how we're set up to take contributions. Our contributing guide asks you to comment on an issue and wait for someone on the team to assign it to you before you start. We do that so two people don't end up fixing the same thing, and so we can agree on the approach first. A few of these PRs landed on issues that already had someone assigned, and I can't review 20+ PRs across unrelated parts of the codebase from one person anyway. If you'd like to contribute, please read CONTRIBUTING.md, pick one issue, and ask to be assigned. A |
Fixes #6762.
Problem
Manager.TerminatePhase 2 (full MultiSession) deleted the storage record but left the node-localValidatingCacheentry in place. Backend connections stayed open until a subsequentGetMultiSessiontriggered lazy eviction (checkSession→ErrExpired→onEvict→ Close).Under sustained create/terminate churn the cache never shrank, accumulating ~2.3 MiB per terminated session until the pod was OOM-killed. The default
CacheCapacity=1000is not configurable, so this was unbounded.Fix
pkg/cache/validating_cache.go: addValidatingCache.Remove(key)with the same lock discipline asRemoveMatching— remove undermu, run the useronEvictoff the lock viadrainEvictions.pkg/vmcp/server/sessionmanager/session_manager.go: callsm.sessions.Remove(sessionID)inTerminate's Phase 2 branch right after the storage delete, soonEvictcloses the backend connections immediately instead of on the next request.The storage delete happens first, so the existing
loadSessionSET XX guard still rejects in-flight restores; other replicas still self-heal viacheckSessionon their nextGet.The pre-existing narrow window (an
Updatethat lands between the delete and a concurrentGetmiss insertion) is unchanged by this patch.Tests
TestRemove(cache): present → true + one onEvict + entry gone; absent → false + no eviction + cache unchanged; surviving entry still served from cache.session_manager_test.goterminate paths now assertsm.sessions.Len()==0immediately afterTerminate(previously relied on a subsequent Get).go test -race ./pkg/cache/ ./pkg/vmcp/server/sessionmanager/ -count=1passes.