Skip to content

fix(idle): wake suspended workers on web access on macOS#681

Merged
geodro merged 1 commit into
mainfrom
fix/idle-wake-web-access-macos
Jun 29, 2026
Merged

fix(idle): wake suspended workers on web access on macOS#681
geodro merged 1 commit into
mainfrom
fix/idle-wake-web-access-macos

Conversation

@geodro

@geodro geodro commented Jun 29, 2026

Copy link
Copy Markdown
Member

Problem

On macOS, idle-suspended background workers (horizon, schedule, vite, stripe) never resumed when their site was accessed in a browser. The site kept serving, but its workers stayed stopped until a source-file edit or a terminal artisan/composer/npm command touched the site.

Idle-suspend resumes a site's workers when activity arrives via the nginx access feed (nginx logs each request host, the watcher reads it and calls OnActivity). That feed was bound on Linux only. On macOS nginx runs inside the podman-machine VM, where the host unix socket isn't reachable, so the watcher skipped binding it (if runtime.GOOS != "darwin"). With no feed, a browser request produced zero activity and the engine never resumed the workers. The site sat at "idle Nh" with a frozen last-active, and the watcher log showed it suspended repeatedly and never resumed.

Fix

Deliver the feed over a transport that crosses the VM boundary on macOS. nginx ships each request host as UDP syslog to host.containers.internal:9914, and the watcher binds 127.0.0.1:9914 to receive it, the same gvproxy-forwarded path the dump receiver already uses on 9913. From there it reuses the existing OnActivity to resume flow. Linux is byte-for-byte unchanged: AccessLogTarget() still returns the bind-mounted unix socket and the watcher binds the same unix datagram socket.

Verification

  • go test ./... passes, including new TestAccessLogTarget_matchesOS and TestReadAccessFeed_overUDP.
  • Live on macOS: with a site suspended, a single curl https://pickrightsports.test/ produced [idle] resumed pickrightsports: [horizon schedule vite stripe] within 3s. Before the change the watcher log only ever recorded suspends, never a resume.

Fixes #680

Idle-suspend resumes a site's workers when the nginx access feed reports
a request, but that feed was bound on Linux only. On macOS nginx runs in
the podman-machine VM where the host unix socket isn't reachable, so the
feed was skipped and a browser request produced no activity. Suspended
workers (horizon, schedule, vite, stripe) stayed stopped until a source
edit or a terminal command touched the site.

Deliver the feed over a transport that crosses the VM boundary on macOS:
nginx ships the request host as UDP syslog to host.containers.internal,
and the watcher binds a loopback UDP port to receive it, reusing the same
gvproxy-forwarded path the dump receiver uses. The OnActivity resume flow
is unchanged, and Linux keeps the bind-mounted unix socket.

Fixes #680
@geodro geodro merged commit da97b7b into main Jun 29, 2026
3 checks passed
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.

Idle-suspended workers never wake on web access (macOS)

1 participant