@calltelemetry/fmix 2.7.28 → 2.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fmix +248 -23
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -28,7 +28,7 @@ set -uo pipefail
|
|
|
28
28
|
# ---------------------------------------------------------------------------
|
|
29
29
|
# Constants & config
|
|
30
30
|
# ---------------------------------------------------------------------------
|
|
31
|
-
FMIX_VERSION="2.7.
|
|
31
|
+
FMIX_VERSION="2.7.29"
|
|
32
32
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
33
33
|
FMIX_OS="$(uname -s)"
|
|
34
34
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -157,6 +157,9 @@ FMIX_PENDING_LOCK_KEEPER_STATE=""
|
|
|
157
157
|
# was retired: "bootstrap_deadline" (host load; retryable) or "bootstrap_failed"
|
|
158
158
|
# (genuine; fail fast). Callers branch on this, never on the message text.
|
|
159
159
|
FMIX_LAST_LOCK_KEEPER_FAILURE=""
|
|
160
|
+
# The typed failure the last keeper start observed, kept even when retirement
|
|
161
|
+
# failed. A permit loop reads it to make a deadline terminal, never retried.
|
|
162
|
+
FMIX_LAST_LOCK_KEEPER_OBSERVED=""
|
|
160
163
|
|
|
161
164
|
# Set by fmix_activate_session before any mutable artifact, stamp, or scratch
|
|
162
165
|
# database path is resolved.
|
|
@@ -7218,6 +7221,7 @@ fmix_lock_keeper_start() {
|
|
|
7218
7221
|
local bootstrap_secs failure_kind="bootstrap_failed" retryable=false
|
|
7219
7222
|
local probe_pid
|
|
7220
7223
|
FMIX_LAST_LOCK_KEEPER_FAILURE=""
|
|
7224
|
+
FMIX_LAST_LOCK_KEEPER_OBSERVED=""
|
|
7221
7225
|
# Failed retirement is not contention. Preserve its exact recovery handle
|
|
7222
7226
|
# rather than overwriting it with a second keeper, even for a different lock.
|
|
7223
7227
|
if [[ -n "$FMIX_PENDING_LOCK_KEEPER_PID" ]]; then
|
|
@@ -7309,7 +7313,20 @@ def io_failure(operation, target, error):
|
|
|
7309
7313
|
raise SystemExit(70)
|
|
7310
7314
|
|
|
7311
7315
|
|
|
7316
|
+
def remove_state():
|
|
7317
|
+
try:
|
|
7318
|
+
state_path.unlink()
|
|
7319
|
+
except OSError:
|
|
7320
|
+
pass
|
|
7321
|
+
|
|
7322
|
+
|
|
7312
7323
|
def publish_state(value):
|
|
7324
|
+
# A waiter that died can never read this handshake. Removing it here (the
|
|
7325
|
+
# keeper outlives a SIGKILLed waiter until its next liveness poll) means a
|
|
7326
|
+
# killed waiter leaves no keeper state behind.
|
|
7327
|
+
if not owner_alive():
|
|
7328
|
+
remove_state()
|
|
7329
|
+
return
|
|
7313
7330
|
temporary = state_path.with_name(
|
|
7314
7331
|
state_path.name + f".tmp-{os.getpid()}"
|
|
7315
7332
|
)
|
|
@@ -7429,8 +7446,10 @@ finally:
|
|
|
7429
7446
|
started)
|
|
7430
7447
|
# Do not unlink an intermediate state: the atomic ready
|
|
7431
7448
|
# publication could otherwise be removed before we read it.
|
|
7449
|
+
# SECONDS is whole-second: observed at N.99 s, "+1" would
|
|
7450
|
+
# expire ~10 ms later. "+2" always leaves a real second.
|
|
7432
7451
|
[[ -n "$acquire_deadline" ]] \
|
|
7433
|
-
|| acquire_deadline=$(( SECONDS + 10#$timeout +
|
|
7452
|
+
|| acquire_deadline=$(( SECONDS + 10#$timeout + 2 ))
|
|
7434
7453
|
;;
|
|
7435
7454
|
timeout)
|
|
7436
7455
|
# Only the keeper's actual flock contention is retryable.
|
|
@@ -7439,6 +7458,9 @@ finally:
|
|
|
7439
7458
|
;;
|
|
7440
7459
|
*)
|
|
7441
7460
|
failure="invalid keeper handshake"
|
|
7461
|
+
if fmix_lock_keeper_contended "$keeper_pid" "$path" "$py_bin"; then
|
|
7462
|
+
failure_kind=contention
|
|
7463
|
+
fi
|
|
7442
7464
|
break
|
|
7443
7465
|
;;
|
|
7444
7466
|
esac
|
|
@@ -7459,21 +7481,97 @@ finally:
|
|
|
7459
7481
|
fi
|
|
7460
7482
|
elif (( SECONDS >= acquire_deadline )); then
|
|
7461
7483
|
failure="keeper readiness deadline exceeded"
|
|
7484
|
+
if fmix_lock_keeper_contended "$keeper_pid" "$path" "$py_bin"; then
|
|
7485
|
+
failure_kind=contention
|
|
7486
|
+
else
|
|
7487
|
+
# A keeper woken just before the deadline may not have taken
|
|
7488
|
+
# the lock yet. One grace re-probe before calling it fatal.
|
|
7489
|
+
sleep 0.2
|
|
7490
|
+
if fmix_lock_keeper_contended "$keeper_pid" "$path" "$py_bin"; then
|
|
7491
|
+
failure_kind=contention
|
|
7492
|
+
fi
|
|
7493
|
+
fi
|
|
7462
7494
|
break
|
|
7463
7495
|
fi
|
|
7464
7496
|
sleep 0.05
|
|
7465
7497
|
done
|
|
7466
|
-
|
|
7467
|
-
#
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7498
|
+
# Live contention (keeper alive, kernel lock held by another process) is
|
|
7499
|
+
# not a bootstrap failure: it is retryable silently, and the caller reports
|
|
7500
|
+
# its holders only when its budget runs out.
|
|
7501
|
+
if [[ "$failure_kind" != contention ]]; then
|
|
7502
|
+
[[ "$failure_kind" != bootstrap_deadline ]] || retryable=true
|
|
7503
|
+
# This is exactly the child launched above, never an inferred lock holder.
|
|
7504
|
+
printf '{"error":"lock_keeper_bootstrap_failed","reason":"%s","retryable":%s}\n' \
|
|
7505
|
+
"$failure" "$retryable" >&2
|
|
7506
|
+
fi
|
|
7507
|
+
FMIX_LAST_LOCK_KEEPER_OBSERVED="$failure_kind"
|
|
7508
|
+
if [[ "$failure_kind" == bootstrap_deadline ]] \
|
|
7509
|
+
&& fmix_lock_keeper_kill_unstarted "$keeper_pid" "$state"; then
|
|
7510
|
+
# Exit is proven by wait; no handshake or lock existed to clean up.
|
|
7511
|
+
rm -f "$state" "$state.tmp-$keeper_pid" 2>/dev/null || true
|
|
7512
|
+
[[ "$FMIX_LAST_LOCK_KEEPER_PID" != "$keeper_pid" ]] || FMIX_LAST_LOCK_KEEPER_PID=""
|
|
7513
|
+
else
|
|
7514
|
+
fmix_lock_keeper_retire "$keeper_pid" "$state" || return 70
|
|
7515
|
+
fi
|
|
7471
7516
|
# Publish the typed kind only after the abandoned keeper is confirmed gone:
|
|
7472
7517
|
# a retry must never run beside a keeper this attempt failed to retire.
|
|
7473
7518
|
FMIX_LAST_LOCK_KEEPER_FAILURE="$failure_kind"
|
|
7519
|
+
if [[ "$failure_kind" == contention ]]; then
|
|
7520
|
+
return 1
|
|
7521
|
+
fi
|
|
7474
7522
|
return 70
|
|
7475
7523
|
}
|
|
7476
7524
|
|
|
7525
|
+
fmix_lock_keeper_contended() {
|
|
7526
|
+
# Evidence for a retryable keeper failure: the keeper is still alive and the
|
|
7527
|
+
# kernel lock it waits on is held by another process. A dead keeper is a
|
|
7528
|
+
# crash; a live keeper on a free lock is not waiting for anyone. Both stay
|
|
7529
|
+
# fatal. The try-lock is shared, so it cannot evict an exclusive holder.
|
|
7530
|
+
local keeper_pid="$1" kernel_path="$2" py_bin="$3"
|
|
7531
|
+
kill -0 "$keeper_pid" 2>/dev/null || return 1
|
|
7532
|
+
"$py_bin" -I -B -c 'import fcntl, sys
|
|
7533
|
+
try:
|
|
7534
|
+
handle = open(sys.argv[1], "a+")
|
|
7535
|
+
except OSError:
|
|
7536
|
+
raise SystemExit(1)
|
|
7537
|
+
try:
|
|
7538
|
+
fcntl.flock(handle, fcntl.LOCK_SH | fcntl.LOCK_NB)
|
|
7539
|
+
except BlockingIOError:
|
|
7540
|
+
raise SystemExit(0)
|
|
7541
|
+
except OSError:
|
|
7542
|
+
raise SystemExit(1)
|
|
7543
|
+
raise SystemExit(1)' "$kernel_path" </dev/null >/dev/null 2>&1
|
|
7544
|
+
}
|
|
7545
|
+
|
|
7546
|
+
fmix_lock_contention_report() {
|
|
7547
|
+
# Names the holder of a generic lock when a caller gives up on contention.
|
|
7548
|
+
local lock_name="$1" diagnostic_name="$2" timeout="$3" metadata_file holder_pid
|
|
7549
|
+
metadata_file="$FMIX_HOME/lock-metadata/${lock_name}.json"
|
|
7550
|
+
holder_pid="$(sed -n 's/.*"pid"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' \
|
|
7551
|
+
"$metadata_file" 2>/dev/null | head -1)"
|
|
7552
|
+
fmix_error "Timed out waiting for kernel lock '$diagnostic_name' after ${timeout}s: still held by another process (holder pid ${holder_pid:-unknown})."
|
|
7553
|
+
fmix_error "Inspect with: fmix status"
|
|
7554
|
+
}
|
|
7555
|
+
|
|
7556
|
+
fmix_compile_permit_holders_json() {
|
|
7557
|
+
# JSON array of live compile-permit holders: pid, worktree and age in seconds.
|
|
7558
|
+
local file pid worktree started epoch now age entries="" sep=""
|
|
7559
|
+
now="$(fmix_epoch)"
|
|
7560
|
+
for file in "$FMIX_HOME"/lock-metadata/compile-permit-*.json; do
|
|
7561
|
+
[[ -f "$file" && ! -L "$file" ]] || continue
|
|
7562
|
+
pid="$(sed -n 's/.*"pid": *\([0-9][0-9]*\).*/\1/p' "$file" | head -1)"
|
|
7563
|
+
[[ -n "$pid" ]] || continue
|
|
7564
|
+
worktree="$(sed -n 's/.*"worktree": *\(".*"\).*/\1/p' "$file" | head -1)"
|
|
7565
|
+
[[ -n "$worktree" ]] || worktree='""'
|
|
7566
|
+
started="$(sed -n 's/.*"start_time": *"\([^"]*\)".*/\1/p' "$file" | head -1)"
|
|
7567
|
+
epoch="$(fmix_iso_epoch "$started" 2>/dev/null)" || epoch=""
|
|
7568
|
+
if [[ "$epoch" =~ ^[0-9]+$ ]]; then age=$(( now - epoch )); else age=-1; fi
|
|
7569
|
+
entries="${entries}${sep}{\"pid\": ${pid}, \"worktree\": ${worktree}, \"age_s\": ${age}}"
|
|
7570
|
+
sep=", "
|
|
7571
|
+
done
|
|
7572
|
+
printf '[%s]' "$entries"
|
|
7573
|
+
}
|
|
7574
|
+
|
|
7477
7575
|
fmix_lock_keeper_reap_completed() {
|
|
7478
7576
|
local keeper_pid="$1" job_line
|
|
7479
7577
|
local terminal_job='^\[[0-9]+\][+-]?[[:space:]]+([1-9][0-9]*)[[:space:]]+(Done|Exit|Killed|Terminated|Hangup|Interrupt)([[:space:]:]|$)'
|
|
@@ -7512,6 +7610,23 @@ fmix_lock_keeper_signal_owned() {
|
|
|
7512
7610
|
return 70
|
|
7513
7611
|
}
|
|
7514
7612
|
|
|
7613
|
+
fmix_lock_keeper_kill_unstarted() {
|
|
7614
|
+
# Only for a keeper that never published a handshake (bootstrap deadline).
|
|
7615
|
+
# It holds no kernel lock and no FIFO, so its death strands nothing. An
|
|
7616
|
+
# owned running keeper is SIGKILLed and exit is proven by wait. The probe
|
|
7617
|
+
# stop path is bounded by whole-second SECONDS and can miss its budget under
|
|
7618
|
+
# host load, which left retirement failing and the deadline unclassified.
|
|
7619
|
+
local keeper_pid="$1" state="$2"
|
|
7620
|
+
[[ "$keeper_pid" =~ ^[1-9][0-9]*$ ]] || return 1
|
|
7621
|
+
[[ ! -s "$state" ]] || return 1
|
|
7622
|
+
fmix_lock_keeper_signal_owned "$keeper_pid" KILL || return 1
|
|
7623
|
+
wait "$keeper_pid" 2>/dev/null || true
|
|
7624
|
+
if kill -0 "$keeper_pid" 2>/dev/null; then
|
|
7625
|
+
return 1
|
|
7626
|
+
fi
|
|
7627
|
+
return 0
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7515
7630
|
fmix_lock_keeper_stop() {
|
|
7516
7631
|
local keeper_pid="${1:-}" child_pid owned=0 py_bin probe_source probe_pid
|
|
7517
7632
|
local cleanup_deadline kill_at remaining ignored keeper_done=0 probe_done=0
|
|
@@ -7561,11 +7676,13 @@ fmix_lock_keeper_stop() {
|
|
|
7561
7676
|
# no foreground mkfifo/interpreter startup or blocking FIFO open can run
|
|
7562
7677
|
# beyond the owning shell deadline. A writer connects nonblockingly only
|
|
7563
7678
|
# after our read/write open; it then unlinks the private create-only FIFO.
|
|
7564
|
-
probe_source='import errno, os, sys, time
|
|
7679
|
+
probe_source='import errno, os, signal, sys, time
|
|
7565
7680
|
pid = int(sys.argv[1])
|
|
7566
7681
|
channel = sys.argv[2]
|
|
7567
7682
|
fd = -1
|
|
7568
7683
|
created = False
|
|
7684
|
+
# SIGTERM leaves through the finally block below, which removes the FIFO.
|
|
7685
|
+
signal.signal(signal.SIGTERM, lambda _signum, _frame: sys.exit(1))
|
|
7569
7686
|
try:
|
|
7570
7687
|
os.mkfifo(channel, 0o600)
|
|
7571
7688
|
created = True
|
|
@@ -7667,6 +7784,12 @@ finally:
|
|
|
7667
7784
|
# A refused probe signal stays latched even after a later confirmed exit.
|
|
7668
7785
|
# Keep its recovery handle; never turn disappearance into a green cleanup.
|
|
7669
7786
|
(( keeper_refused == 0 && probe_refused == 0 )) || return 70
|
|
7787
|
+
# SIGKILL cannot run the probe's finally block. Once this exact probe has
|
|
7788
|
+
# exited or been signalled, it can no longer unlink its private FIFO, so
|
|
7789
|
+
# the owning shell removes the orphan it created.
|
|
7790
|
+
if [[ -e "$probe_channel" || -L "$probe_channel" ]] && (( probe_done || probe_killed )); then
|
|
7791
|
+
rm -f "$probe_channel" 2>/dev/null || true
|
|
7792
|
+
fi
|
|
7670
7793
|
if [[ -e "$probe_channel" || -L "$probe_channel" ]]; then
|
|
7671
7794
|
# An orphaned channel is not a live child or a signal permit. Retain
|
|
7672
7795
|
# the caller's typed cleanup failure, but never restore an already
|
|
@@ -7763,6 +7886,18 @@ fmix_lock_acquire() {
|
|
|
7763
7886
|
fmix_lock_keeper_start "$kernel_file" "$mode" "$remaining" \
|
|
7764
7887
|
"$diagnostic_name" "$lock_name" || keeper_rc=$?
|
|
7765
7888
|
if (( keeper_rc != 0 )); then
|
|
7889
|
+
case "$FMIX_LAST_LOCK_KEEPER_FAILURE" in
|
|
7890
|
+
contention|bootstrap_deadline)
|
|
7891
|
+
# Retryable keeper failures spend the caller's budget, never
|
|
7892
|
+
# a fixed retry count. Once it is spent, name the holder.
|
|
7893
|
+
if (( $(fmix_epoch) < deadline )); then
|
|
7894
|
+
sleep 0.2
|
|
7895
|
+
continue
|
|
7896
|
+
fi
|
|
7897
|
+
fmix_lock_contention_report "$lock_name" "$diagnostic_name" "$timeout"
|
|
7898
|
+
return 1
|
|
7899
|
+
;;
|
|
7900
|
+
esac
|
|
7766
7901
|
(( keeper_rc == 1 )) || return "$keeper_rc"
|
|
7767
7902
|
fmix_error "Timed out waiting for kernel lock '$diagnostic_name' after ${timeout}s."
|
|
7768
7903
|
fmix_error "Inspect with: fmix status"
|
|
@@ -15127,6 +15262,14 @@ fmix_compile_semaphore_acquire() {
|
|
|
15127
15262
|
bootstrap_transient=1
|
|
15128
15263
|
break
|
|
15129
15264
|
fi
|
|
15265
|
+
# The deadline was observed, but its abandoned keeper could not be
|
|
15266
|
+
# retired. Retrying beside an unretired keeper is forbidden, so the
|
|
15267
|
+
# deadline is terminal and is reported as exhausted.
|
|
15268
|
+
if [[ "$FMIX_LAST_LOCK_KEEPER_OBSERVED" == bootstrap_deadline ]]; then
|
|
15269
|
+
printf '{"error":"lock_keeper_bootstrap_deadline_exhausted","retries":%d,"retired":false}\n' \
|
|
15270
|
+
"$bootstrap_retries" >&2
|
|
15271
|
+
return 70
|
|
15272
|
+
fi
|
|
15130
15273
|
# A genuine bootstrap error is not permit contention. Surface
|
|
15131
15274
|
# its typed failure immediately instead of retrying it.
|
|
15132
15275
|
return "$keeper_rc"
|
|
@@ -15175,8 +15318,8 @@ EOF
|
|
|
15175
15318
|
local estimated_wait=$(( (queue_depth / permits) * estimated_compile_s ))
|
|
15176
15319
|
if (( elapsed + estimated_wait + estimated_compile_s > deadline_secs )); then
|
|
15177
15320
|
local err_json
|
|
15178
|
-
err_json="$(printf '{"error": "host_compile_deadline_exceeded", "queue_depth": %d, "estimated_wait_s": %d, "permit_limit": %d}' \
|
|
15179
|
-
"$queue_depth" "$estimated_wait" "$permits")"
|
|
15321
|
+
err_json="$(printf '{"error": "host_compile_deadline_exceeded", "queue_depth": %d, "estimated_wait_s": %d, "permit_limit": %d, "holders": %s}' \
|
|
15322
|
+
"$queue_depth" "$estimated_wait" "$permits" "$(fmix_compile_permit_holders_json)")"
|
|
15180
15323
|
printf '%s\n' "$err_json" >&2
|
|
15181
15324
|
return 75
|
|
15182
15325
|
fi
|
|
@@ -20443,6 +20586,25 @@ fmix_session_last_from_meta() {
|
|
|
20443
20586
|
|
|
20444
20587
|
# Keep one warm session per worktree realpath (prefer worktree-default source,
|
|
20445
20588
|
# then newest last_accessed). Reap the rest when do_reap=1.
|
|
20589
|
+
fmix_lock_metadata_expired_entries() {
|
|
20590
|
+
# Prints "<whole-days><TAB><path>" for each real, non-hidden directory
|
|
20591
|
+
# directly under $1 whose mtime is more than the TTL before $2 (epoch).
|
|
20592
|
+
local dir="$1" now="$2" ttl="$3"
|
|
20593
|
+
if [[ "$FMIX_OS" == Darwin ]]; then
|
|
20594
|
+
find "$dir" -mindepth 1 -maxdepth 1 -type d ! -name '.*' \
|
|
20595
|
+
-exec stat -f '%m %N' {} + 2>/dev/null
|
|
20596
|
+
else
|
|
20597
|
+
find "$dir" -mindepth 1 -maxdepth 1 -type d ! -name '.*' \
|
|
20598
|
+
-exec stat -c '%Y %n' {} + 2>/dev/null
|
|
20599
|
+
fi | awk -v now="$now" -v ttl="$ttl" '
|
|
20600
|
+
{
|
|
20601
|
+
mtime = $1
|
|
20602
|
+
path = substr($0, length($1) + 2)
|
|
20603
|
+
age = now - mtime
|
|
20604
|
+
if (age > ttl) printf "%d\t%s\n", age / 86400, path
|
|
20605
|
+
}'
|
|
20606
|
+
}
|
|
20607
|
+
|
|
20446
20608
|
fmix_gc_consolidate_sessions() {
|
|
20447
20609
|
local do_reap="$1" skip_prompts="$2" worktree_filter="${3:-}"
|
|
20448
20610
|
local real_filter="" py_bin
|
|
@@ -22824,23 +22986,86 @@ cmd_gc() {
|
|
|
22824
22986
|
lock_metadata_ttl_seconds=$(( lock_metadata_ttl_days * 86400 ))
|
|
22825
22987
|
echo ""
|
|
22826
22988
|
echo "--- Retired lock metadata older than ${lock_metadata_ttl_days} days ---"
|
|
22827
|
-
local metadata_class
|
|
22989
|
+
local metadata_class metadata_dir metadata_now metadata_expired metadata_count
|
|
22990
|
+
metadata_now="$(fmix_epoch)"
|
|
22828
22991
|
for metadata_class in released stale; do
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22992
|
+
metadata_dir="$FMIX_HOME/lock-metadata/$metadata_class"
|
|
22993
|
+
[[ -d "$metadata_dir" ]] || continue
|
|
22994
|
+
# One find+stat pass per class replaces a date, stat and realpath
|
|
22995
|
+
# fork per entry. Eligibility is unchanged: the same real directory
|
|
22996
|
+
# whose mtime is more than the TTL before now.
|
|
22997
|
+
metadata_expired="$(fmix_lock_metadata_expired_entries \
|
|
22998
|
+
"$metadata_dir" "$metadata_now" "$lock_metadata_ttl_seconds")"
|
|
22999
|
+
[[ -n "$metadata_expired" ]] || continue
|
|
23000
|
+
metadata_count="$(printf '%s\n' "$metadata_expired" | wc -l | tr -d ' ')"
|
|
23001
|
+
printf '%s\n' "$metadata_expired" | awk -F '\t' '{ print " OLD: " $2 " (age=" $1 "d)" }'
|
|
23002
|
+
actions=$(( actions + metadata_count ))
|
|
23003
|
+
if (( do_reap == 1 )); then
|
|
23004
|
+
# The class directory is the guarded root: its entries are
|
|
23005
|
+
# non-symlink children, so one check covers every removal.
|
|
23006
|
+
if fmix_guard_path "$metadata_dir"; then
|
|
23007
|
+
if printf '%s\n' "$metadata_expired" | awk -F '\t' '{ print $2 }' \
|
|
23008
|
+
| tr '\n' '\0' | xargs -0 rm -rf --; then
|
|
23009
|
+
echo " Deleted: $metadata_count retired lock-metadata entries from $metadata_dir"
|
|
23010
|
+
else
|
|
23011
|
+
fmix_warn "Some retired lock metadata in $metadata_dir could not be removed."
|
|
23012
|
+
fi
|
|
23013
|
+
else
|
|
23014
|
+
fmix_warn "Keeping retired lock metadata in $metadata_dir: root is not under FMIX_HOME."
|
|
23015
|
+
fi
|
|
23016
|
+
fi
|
|
23017
|
+
done
|
|
23018
|
+
|
|
23019
|
+
# Keeper handshakes and probe FIFOs carry the PID of the shell that made
|
|
23020
|
+
# them. A dead owner can never read or unlink them; a live owner keeps them.
|
|
23021
|
+
echo ""
|
|
23022
|
+
echo "--- Keeper state and probe FIFOs with dead owners ---"
|
|
23023
|
+
local owner_artifact owner_list owner_dead owner_path py_owner_bin
|
|
23024
|
+
py_owner_bin="$(fmix_python_bin 2>/dev/null || echo python3)"
|
|
23025
|
+
owner_list=""
|
|
23026
|
+
for owner_artifact in "$FMIX_HOME/lock-keeper-state"/*.state "$FMIX_HOME"/.lock-stop-probe-*; do
|
|
23027
|
+
[[ -e "$owner_artifact" || -L "$owner_artifact" ]] || continue
|
|
23028
|
+
owner_list="${owner_list}${owner_artifact}"$'\n'
|
|
23029
|
+
done
|
|
23030
|
+
if [[ -n "$owner_list" ]]; then
|
|
23031
|
+
owner_dead="$(printf '%s' "$owner_list" | "$py_owner_bin" -I -B -c '
|
|
23032
|
+
import os, re, stat, sys
|
|
23033
|
+
state = re.compile(r"^(.+)\.([0-9]+)\.[0-9]+\.state$")
|
|
23034
|
+
probe = re.compile(r"^\.lock-stop-probe-([0-9]+)-[0-9]+-[0-9]+$")
|
|
23035
|
+
for path in sys.stdin.read().splitlines():
|
|
23036
|
+
if not path or os.path.islink(path):
|
|
23037
|
+
continue
|
|
23038
|
+
name = os.path.basename(path)
|
|
23039
|
+
if os.path.basename(os.path.dirname(path)) == "lock-keeper-state":
|
|
23040
|
+
match = state.match(name)
|
|
23041
|
+
else:
|
|
23042
|
+
match = probe.match(name)
|
|
23043
|
+
if match and not stat.S_ISFIFO(os.lstat(path).st_mode):
|
|
23044
|
+
continue
|
|
23045
|
+
if not match:
|
|
23046
|
+
continue
|
|
23047
|
+
try:
|
|
23048
|
+
os.kill(int(match.group(2) if match.re is state else match.group(1)), 0)
|
|
23049
|
+
except ProcessLookupError:
|
|
23050
|
+
print(path)
|
|
23051
|
+
except OSError:
|
|
23052
|
+
pass
|
|
23053
|
+
' 2>/dev/null)"
|
|
23054
|
+
fi
|
|
23055
|
+
if [[ -n "$owner_dead" ]]; then
|
|
23056
|
+
# Every candidate is a direct child of FMIX_HOME: one guard covers all.
|
|
23057
|
+
if (( do_reap == 1 )) && ! fmix_guard_path "$FMIX_HOME"; then
|
|
23058
|
+
fmix_warn "Keeping dead-owner keeper artifacts: FMIX_HOME guard failed."
|
|
23059
|
+
fi
|
|
23060
|
+
while IFS= read -r owner_path; do
|
|
23061
|
+
[[ -n "$owner_path" ]] || continue
|
|
23062
|
+
echo " DEAD OWNER: $owner_path"
|
|
22836
23063
|
actions=$(( actions + 1 ))
|
|
22837
23064
|
if (( do_reap == 1 )); then
|
|
22838
|
-
|
|
22839
|
-
&& rm -rf "$metadata_entry" \
|
|
22840
|
-
&& echo " Deleted: $metadata_entry"
|
|
23065
|
+
rm -f "$owner_path" 2>/dev/null && echo " Deleted: $owner_path"
|
|
22841
23066
|
fi
|
|
22842
|
-
done
|
|
22843
|
-
|
|
23067
|
+
done <<<"$owner_dead"
|
|
23068
|
+
fi
|
|
22844
23069
|
|
|
22845
23070
|
# Published artifacts are not released by age or --yes. The former
|
|
22846
23071
|
# template path lacked reader coordination; the dependency path lacked
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.29",
|
|
4
4
|
"description": "Verified native FMix runner for CallTelemetry workspaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/npm"
|
|
27
27
|
},
|
|
28
28
|
"fmix": {
|
|
29
|
-
"runnerSha256": "
|
|
30
|
-
"sourceTag": "fmix-v2.7.
|
|
29
|
+
"runnerSha256": "cb79676edbcf683cd4962938b4bfb2ae1c2e807889da04b0586388c0c5b0513b",
|
|
30
|
+
"sourceTag": "fmix-v2.7.29"
|
|
31
31
|
}
|
|
32
32
|
}
|