Rename dArkOS proxy process to survive game-end killall python3 cleanup - #54
Open
chrishaw wants to merge 2 commits into
Open
Rename dArkOS proxy process to survive game-end killall python3 cleanup#54chrishaw wants to merge 2 commits into
chrishaw wants to merge 2 commits into
Conversation
dArkOS's EmulationStation game-end hook runs `sudo killall python3` on every game exit, which matches the proxy by kernel process name since it runs as `python3 -m raofflineproxy.main run-service`. Rename the process via prctl(PR_SET_NAME, ...) so it's no longer swept up.
Author
|
Disclosure: had AI help on this. Confirmed this works on R36S running dArkOSen-R36S |
misantronic
reviewed
Jul 31, 2026
misantronic
left a comment
Owner
There was a problem hiding this comment.
I will additionally add some github actions to automate test-runs for PRs
Addresses review comment: a libc without prctl left no trace when the process-rename fallback failed.
misantronic
reviewed
Aug 3, 2026
| comm, not argv/cgroup) don't kill the service by accident.""" | ||
| try: | ||
| libc = ctypes.CDLL(None, use_errno=True) | ||
| libc.prctl(PR_SET_NAME, name.encode("utf-8"), 0, 0, 0) |
Owner
There was a problem hiding this comment.
ctypes doesn't raise on a non-zero return value, so this except never catches an actual prctl() failure (only missing-symbol/load errors). The warning log added for the earlier comment still won't fire on a real syscall failure.
ret = libc.prctl(PR_SET_NAME, name.encode("utf-8"), 0, 0, 0)
if ret != 0:
errno = ctypes.get_errno()
logging.getLogger("raofflineproxy").warning(
"Failed to rename process via prctl (errno=%s); comm name stays %r", errno, name
)Also, logging.getLogger("raofflineproxy") is now called in two places in this file, worth pulling into a module-level logger = logging.getLogger("raofflineproxy") and reusing it.
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
sudo killall python3on every game exit (confirmed via journalctl), which matches the proxy service by kernel process name since it runs aspython3 -m raofflineproxy.main run-service.prctl(PR_SET_NAME, ...)so it's no longer swept up by that cleanup command. Service discovery (discover_service_pids()) is unaffected since it matches on/proc/pid/cmdline, notcomm.Test plan
ps -o pid,comm,argsshowscomm=raofflineproxyafter the fix (previouslypython3)