You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: store lock refuses restart with a recycled PID; short-link and write-concurrency gaps #469
main at d939969 (static source review; not executed against a deployment). Node/OS/deployment: not applicable.
Minimal reproduction
Reported by review, not independently reproduced. All in packages/store/src/store.ts.
Stale lock with a recycled PID.lock() (lines 31-49) treats a lock file containing the current process's PID as live. A container restarted after an unclean exit usually runs as the same PID (often PID 1), so it refuses to start until the lock file is removed by hand. There is also a small window between open(path, 'wx') and writeFile in which another process reads an empty PID.
Fix: record a boot/instance identifier (or process start time) alongside the PID, treat a lock carrying our own PID but not our own instance id as stale, and write the lock atomically (write temp file, then link/rename).
Short-link destination may be missing. Short-link validation (lines 91-93) requires the destination field to be a string http-url, but not required. A record without a destination produces 302 Location: undefined (line 168) and still counts a click.
Fix: require the destination field at configuration time, and return 404 without incrementing when the value is absent.
HEAD counts clicks.dispatchShortLink increments on HEAD as well as GET (lines 165-167).
Fix: resolve without incrementing on HEAD.
No conditional writes. PUT/PATCH (lines 153-154) are last-write-wins with no ETag/If-Match.
Fix: return an ETag (record version) and honour If-Match with 412.
Idempotency keys are shared across callers, so two callers that choose the same key collide.
Fix: scope stored keys by principal (or client) when the mount is authenticated.
Activity
fix(store): stale-PID lock reclaim, required short-link destination,
fix(store): stale-PID lock reclaim, required short-link destination,