fix(tor): prevent tor_server crash-loop from silently pinning the CPU - #2177
Open
ptrinh wants to merge 1 commit into
Open
fix(tor): prevent tor_server crash-loop from silently pinning the CPU#2177ptrinh wants to merge 1 commit into
ptrinh wants to merge 1 commit into
Conversation
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
Per-app Tor hidden-service sidecars (
<app>-tor_server-1) can enter a silent, permanent crash-loop that pins a CPU core and thermally throttles the whole device — with nothing surfaced in the UI.On one node, three apps that run
network_mode: host(tailscale,adguard-home,watch-your-lan) accumulated 41,000+ failed restarts over 9 days, holding an Intel N100 at 95 °C and thermal-throttling ~63 % of uptime.docker stats/pslook innocent because every restart resets the per-process CPU counters; the tell is the container restart count and a context-switch storm.Root cause
Two issues compound, both in
packages/umbreld/source/modules/apps/legacy-compat/:app-scriptsets the onion target to80:${APP_PROXY_HOSTNAME}:${APP_PROXY_PORT}(i.e.app_proxy_<app>:<port>). For apps runningnetwork_mode: host, that proxy hostname isn't resolvable from the tor_server's network, so tor rejects theHiddenServicePortaddress and exits.docker-compose.tor.ymldeclaresrestart: on-failure(no retry limit) andtor-entrypoint.shexits immediately on a bad config. Docker therefore recreates the container roughly once a minute, forever, generating continuous container-recreation churn that silently cooks the host.Fix
This PR addresses #2 — the general, trigger-independent failure — in
tor-entrypoint.sh: validate the generated config first and, if it's invalid, retry in place with a 60s backoff inside a single long-lived container instead of fast-exiting into an endless container-recreation loop.tor --verify-configpasses instantly, thenexec tormakes tor PID 1 so it still receives signals cleanly on container stop.Minimal single-file change; no new files, no behavior change for working apps.
🤖 Generated with Claude Code