floci icon indicating copy to clipboard operation
floci copied to clipboard

VerdaccioSidecarManager's beginUse/endUse are no-ops, so a container can leak past DeleteRepository

Open pgermosen opened this issue 1 month ago • 1 comments

RepositorySidecarManager#beginUse/#endUse exist specifically to stop a DeleteRepository from tearing down a sidecar's backing storage while another call is still mid-flight against it (see CodeArtifactService#resolveContainerIdAndBeginUse's own javadoc, used today by ListPackageVersions/ListPackages). PypiserverSidecarManager is the one implementation that actually tracks this; VerdaccioSidecarManager (npm) relies on the interface's own no-op default, so calling beginUse/endUse against it today does nothing real.

Found while adding npm's external-connection retention (#7198): any call that does a real network round trip (an external-connection fetch, but also just a slow container start) between resolving a repository's npm sidecar id and actually touching it can race a concurrent DeleteRepository. If the delete's own cleanup (release) runs first, a later ensureReady against that same, now-stale id starts a fresh container nothing will ever release again, since the repository record it belonged to is already gone.

#7198 narrows this for its own new code with a cheap, best-effort existence re-check right before the sidecar call, but that still leaves an ordinary check-then-act gap (not a full fix, and explicitly not claimed as one there). Closing it properly means giving VerdaccioSidecarManager the same kind of real in-flight-use tracking PypiserverSidecarManager's own container pool already has, so release actually waits for registered uses to finish before tearing anything down. That's a cross-cutting fix (it would also strengthen the pre-existing, already-merged ListPackageVersions/ListPackages paths for npm, not just the new retention code), so it's tracked here as its own, focused piece of work rather than riding along in #7198.

pgermosen avatar Nov 01 '26 13:11 pgermosen

:tada: This issue has been resolved in version 2.5.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

hectorvent avatar Nov 16 '26 03:11 hectorvent