Imported from GitHub samson-media/barn#35 — opened by @daniel-samson on 2026-04-21 23:17:16 UTC
Problem
Barn daemon on video-1 has hung twice now, each time silently — the barn service start process stays alive and responds to barn status, but stops scheduling queued jobs. Diagnostics at the moment of failure:
barn status showed 22 jobs queued across dev/staging/production; zero running.
pgrep -P <barn-pid> returned no children (no curl/ffmpeg spawns).
Host was healthy: load avg 1.65, disk 6% used, mbufs healthy (229/501), no OOM.
Daemon uptime ~35h at the time of the hang.
Laravel side was happily submitting new jobs (they showed up in barn status), so the RPC/listen path was still working — it's the scheduler/executor side that's idle.
There's no launchd plist or supervisor wrapping the daemon, so:
Nothing restarts it on machine reboot (video-1 reboot on 2026-04-20 left barn down until a human sshd in and started it manually).
Nothing restarts it when it hangs like this — production pipeline was idle for hours before the hang was noticed.
There's no log persistence — --foreground to an interactive SSH shell means logs die with the session.
Proposal
Ship a launchd plist so the barn daemon runs as a managed service on video-1 (and any future macOS barn host):
~/Library/LaunchAgents/media.samson.barn.plist (user-level, since jobs run as the admin user and want that user's ffmpeg/VideoToolbox env).
RunAtLoad + KeepAlive so it survives reboots and respawns on exit.
StandardOutPath / StandardErrorPath pointing at /tmp/barn/logs/barn.out / .err (or a persistent location) so we have a trail next time it hangs.
ThrottleInterval to keep respawn loops bounded if barn exits immediately on a bad state.
If barn exposes a liveness check that can detect the "no children running despite queued jobs" case, feed that into launchd via a watchdog script. Otherwise a periodic cron that restarts barn if barn status shows queued-but-nothing-running for >N minutes would work as a cheaper alternative.
Acceptance
Reboot video-1 → barn comes up automatically with no human intervention.
Kill the barn daemon PID → launchd respawns it within seconds.
Logs from the daemon end up on disk (not in a lost SSH session).
Ideally: if barn self-hangs again, a watchdog restarts it within minutes.
Out of scope
Root-causing why barn hangs with children=0 despite queued jobs. Worth a separate issue once we have persistent logs from the next hang — we're flying blind on this one because the runtime for the running daemon has no child / jstack access from the system Java (barn binary is jlink'd).
<!-- github-import:issue:35 -->
_Imported from GitHub samson-media/barn#35 — opened by **@daniel-samson** on 2026-04-21 23:17:16 UTC_
## Problem
Barn daemon on video-1 has hung twice now, each time silently — the `barn service start` process stays alive and responds to `barn status`, but stops scheduling queued jobs. Diagnostics at the moment of failure:
- `barn status` showed 22 jobs queued across dev/staging/production; zero running.
- `pgrep -P <barn-pid>` returned no children (no curl/ffmpeg spawns).
- Host was healthy: load avg 1.65, disk 6% used, mbufs healthy (229/501), no OOM.
- Daemon uptime ~35h at the time of the hang.
- Laravel side was happily submitting new jobs (they showed up in `barn status`), so the RPC/listen path was still working — it's the scheduler/executor side that's idle.
There's no launchd plist or supervisor wrapping the daemon, so:
1. Nothing restarts it on machine reboot (video-1 reboot on 2026-04-20 left barn down until a human `ssh`d in and started it manually).
2. Nothing restarts it when it hangs like this — production pipeline was idle for hours before the hang was noticed.
3. There's no log persistence — `--foreground` to an interactive SSH shell means logs die with the session.
## Proposal
Ship a launchd plist so the barn daemon runs as a managed service on video-1 (and any future macOS barn host):
- `~/Library/LaunchAgents/media.samson.barn.plist` (user-level, since jobs run as the `admin` user and want that user's ffmpeg/VideoToolbox env).
- `RunAtLoad` + `KeepAlive` so it survives reboots and respawns on exit.
- `StandardOutPath` / `StandardErrorPath` pointing at `/tmp/barn/logs/barn.out` / `.err` (or a persistent location) so we have a trail next time it hangs.
- `ThrottleInterval` to keep respawn loops bounded if barn exits immediately on a bad state.
If barn exposes a liveness check that can detect the "no children running despite queued jobs" case, feed that into launchd via a watchdog script. Otherwise a periodic cron that restarts barn if `barn status` shows queued-but-nothing-running for >N minutes would work as a cheaper alternative.
## Acceptance
- Reboot video-1 → barn comes up automatically with no human intervention.
- Kill the barn daemon PID → launchd respawns it within seconds.
- Logs from the daemon end up on disk (not in a lost SSH session).
- Ideally: if barn self-hangs again, a watchdog restarts it within minutes.
## Out of scope
- Root-causing *why* barn hangs with children=0 despite queued jobs. Worth a separate issue once we have persistent logs from the next hang — we're flying blind on this one because the runtime for the running daemon has no child / jstack access from the system Java (barn binary is jlink'd).
This repo is archived. You cannot comment on issues.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Imported from GitHub samson-media/barn#35 — opened by @daniel-samson on 2026-04-21 23:17:16 UTC
Problem
Barn daemon on video-1 has hung twice now, each time silently — the
barn service startprocess stays alive and responds tobarn status, but stops scheduling queued jobs. Diagnostics at the moment of failure:barn statusshowed 22 jobs queued across dev/staging/production; zero running.pgrep -P <barn-pid>returned no children (no curl/ffmpeg spawns).barn status), so the RPC/listen path was still working — it's the scheduler/executor side that's idle.There's no launchd plist or supervisor wrapping the daemon, so:
sshd in and started it manually).--foregroundto an interactive SSH shell means logs die with the session.Proposal
Ship a launchd plist so the barn daemon runs as a managed service on video-1 (and any future macOS barn host):
~/Library/LaunchAgents/media.samson.barn.plist(user-level, since jobs run as theadminuser and want that user's ffmpeg/VideoToolbox env).RunAtLoad+KeepAliveso it survives reboots and respawns on exit.StandardOutPath/StandardErrorPathpointing at/tmp/barn/logs/barn.out/.err(or a persistent location) so we have a trail next time it hangs.ThrottleIntervalto keep respawn loops bounded if barn exits immediately on a bad state.If barn exposes a liveness check that can detect the "no children running despite queued jobs" case, feed that into launchd via a watchdog script. Otherwise a periodic cron that restarts barn if
barn statusshows queued-but-nothing-running for >N minutes would work as a cheaper alternative.Acceptance
Out of scope