fix(gateway): harden macOS PID detection - #12849
Closed
BrennerSpear wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Closing this as a duplicate of I compared the overlapping PRs after opening this and Keeping discussion and maintainer attention on that PR. |
19 tasks
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.
Summary
This hardens macOS gateway PID discovery so Hermes stops producing false negatives when a launchd-managed gateway is alive.
Specifically, this PR:
launchctl list <label>output in_get_service_pids()psarguments for manual gateway process discovery while preserving the existing non-macOS pathpsinvocationProblem
On the affected macOS install, these commands disagreed:
hermes gateway statushermes cron statuslaunchctlshowed the gateway loaded and running with a real PID, butfind_gateway_pids()returned no processes, sohermes cron statusincorrectly claimed the gateway was not running.Root cause
There were two macOS-specific detection bugs:
_get_service_pids()only understood older tabularlaunchctl list <label>output, but newer macOS returns plist-style output like:_scan_gateway_pids()usedps -A eww -o pid=,command=for every non-Windows platform. That works on Linux, but the macOSpson the repro machine rejects that invocation.What changed
launchd PID parsing
Added
_parse_launchctl_pid()and used it from_get_service_pids()so Hermes now accepts both:launchctl listoutputlaunchctl listoutput from newer macOSmacOS-safe process scanning
_scan_gateway_pids()now chooses:ps -A -ww -o pid=,command=ps -A eww -o pid=,command=pathTests
Run locally:
pytest tests/hermes_cli/test_gateway.py tests/hermes_cli/test_update_gateway_restart.py -qResult:
61 passedNotes
I found two existing open PRs in similar territory (#11293 and #10636). I'm opening this because I reproduced the bug locally against a live macOS launchd install, implemented the fix against current
main, and validated it in the current test layout.