Commit 3705414
committed
fix(lock): release flock when Ctrl+C orphans docker children
The flock run-lock is held against the open file description, and bash
sets no close-on-exec on the {_LOCK_FD} redirection fd. Every docker/
compose child and every &-spawned parallel worker therefore inherits the
fd and keeps the lock held until its own copy closes. A Ctrl+C during
`docker compose pull` could orphan a docker subprocess (the signal
handler's `pkill -P` reaches only direct children, racily), and that
orphan kept the inherited fd — and thus the lock — alive, wedging every
later run with "Another hoist run holds the lock".
After acquiring the lock, hand the held fd to one childless holder
process and close our own copy so nothing we fork or exec afterwards can
pin the lock. `disown` keeps the holder out of the job table so the
parallel pool's `wait`/`wait -n` ignore it; the EXIT trap (also reached
via _on_signal's `exit` on INT/TERM) kills the holder, releasing the
lock the instant hoist truly exits — regardless of orphaned children.
Bump to v1.8.2.1 parent d77ae80 commit 3705414
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
430 | 446 | | |
431 | 447 | | |
432 | 448 | | |
| |||
0 commit comments