Skip to content

fix(scanRear): guard kill against missing or stale scan_pid#84

Open
PhilippMundhenk wants to merge 2 commits into
masterfrom
fix/scanrear-pid-kill-guard
Open

fix(scanRear): guard kill against missing or stale scan_pid#84
PhilippMundhenk wants to merge 2 commits into
masterfrom
fix/scanrear-pid-kill-guard

Conversation

@PhilippMundhenk
Copy link
Copy Markdown
Owner

Summary

  • scanRear.sh unconditionally ran kill -9 "$(cat scan_pid)"; rm scan_pid when a duplex back-scan was triggered.
  • If the front-side conversion pipeline had already completed, its tmp_dir (and the scan_pid file inside it) was already removed, so cat printed nothing, kill errored with kill: '': not a pid or valid job spec, and the script aborted before scanning the back pages.
  • Wraps the kill in existence + liveness checks ([ -f scan_pid ] and kill -0) so a late-arriving rear scan is a no-op instead of an error.

Test plan

  • Scan front side and wait > 120 s so the front pipeline finishes and cleans up tmp_dir, then trigger scan-to-email (which calls scanRear.sh). Previously this errored; now it should proceed quietly.
  • Scan front side and trigger scan-to-email before the 120 s sleep elapses. The still-running conversion process should be killed and back pages scanned as before.

🤖 Generated with Claude Code

The unconditional `kill -9 "$(cat scan_pid)"; rm scan_pid` aborts with
"No such file or directory" and "kill: '': not a pid or valid job spec"
when the front-side conversion has already completed and cleaned up
its tmp_dir (which contained scan_pid). Wrap the kill in existence and
liveness checks so a duplex back-scan triggered after the front pipeline
finished does not error out.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant