fix(idle): wake suspended workers on web access on macOS#681
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 binds127.0.0.1:9914to receive it, the same gvproxy-forwarded path the dump receiver already uses on 9913. From there it reuses the existingOnActivityto 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 newTestAccessLogTarget_matchesOSandTestReadAccessFeed_overUDP.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