Commit e19af10
committed
fix(memoize): release flock before early return on cache hit
run_memoized() opens the lock via `exec {lock_fd}>`, a process-level fd
that is not closed when the function returns. The cache-hit path did
`source "${disk_cache_file}"; return 0` without the `flock -u` that the
memoize/write path performs before its own return, leaking the advisory
lock (and the fd) on every cache hit.
Pre-existing, but the new OFFLINE_WORK stale-serve path now takes this
early return for stale entries too (previously stale => deleted =>
fall-through to the unlocking path), so it fires far more often. A second
run_memoized() for the same key in one process would then block until
MEMOIZE_FLOCK_MAX_WAIT. Release the lock before the early return.
Assisted-by: Claude:claude-opus-4.81 parent 3487079 commit e19af10
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
0 commit comments