Release Redis locks only while the caller still owns them #156

Merged
benvin merged 5 commits from benvin/owner-token-locks into master 2026-10-18 02:32:41 +11:00
Member

AcquireLock stored a constant value and ReleaseLock was an unconditional DEL, so a holder that outlived its TTL deleted the next holder's lock. This hits Fetch, Evict and gems push/yank.

  • store a random owner token with SET NX PX and return it from AcquireLock
  • release via a Lua compare-and-delete keyed on that token
  • carry the token through Fetch, Evict and Engine.Lock's release func
  • release the Fetch lock with an uncancelled context
  • make Engine.Lock's busy 503 message generic
AcquireLock stored a constant value and ReleaseLock was an unconditional DEL, so a holder that outlived its TTL deleted the next holder's lock. This hits Fetch, Evict and gems push/yank. - store a random owner token with SET NX PX and return it from AcquireLock - release via a Lua compare-and-delete keyed on that token - carry the token through Fetch, Evict and Engine.Lock's release func - release the Fetch lock with an uncancelled context - make Engine.Lock's busy 503 message generic
unkin-agent added 4 commits 2026-10-18 02:14:18 +11:00
Keep a tombstone on gem yank and reject re-pushing yanked versions
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
4a6bd76976
Roll back a gem push that races a yank and hide gems bookkeeping paths
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
960a5e09a3
Serialise gem push and yank per version with a Redis lock
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
d0fd53222c
Release Redis locks only while the caller still owns them
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
a431319dab
unkin-agent added 1 commit 2026-10-18 02:17:14 +11:00
Merge remote-tracking branch 'origin/master' into benvin/owner-token-locks
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
7b35a1fda0
# Conflicts:
#	internal/api/v1/gems_handler_test.go
#	internal/proxy/engine.go
Author
Member
  • nit: internal/proxy/engine.go:~280 — 503 message still interpolates the Redis error (lock: %v), contradicting the "generic messages" goal → return a fixed string and slog the error.
- nit: internal/proxy/engine.go:~280 — 503 message still interpolates the Redis error (`lock: %v`), contradicting the "generic messages" goal → return a fixed string and slog the error.
benvin merged commit b0d60b3e8a into master 2026-10-18 02:32:41 +11:00
benvin deleted branch benvin/owner-token-locks 2026-10-18 02:32:41 +11:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#156