Repository navigation
Fix config reverts, tunnel teardown, shutdown and key/config file safety - #10
Merged
Merged
Conversation
Config poll loop no longer rolls back the cluster: a config file at a lower version than memory is stale (persisting failed, e.g. a read-only mount), not a manual edit. It used to be re-broadcast at a higher version, undoing every change cluster-wide within 10s. The file is now ignored with a warning, and every config change persists under the dynamic_config lock so the file is always written in version order. proxy_bidirectional: the idle timeout now means no data in either direction for 5 minutes; each direction used to time out on its own, so a one-way stream (download, log tail) was cut at 5 minutes. EOF in one direction now half-closes the other side and keeps the opposite direction running, so a client that shuts down its write side still gets the reply. Graceful shutdown runs on SIGTERM as well as SIGINT (docker stop, systemd, Kubernetes). It used to exit at once on SIGTERM, or ignore it as PID 1, with no NodeLeave and no drain. The drain counts only work in progress: tunnels, mux streams, gossip and admin requests, and subscriber client connections (TCP, HTTP, upgrades). Idle pooled connections and mux sessions used to count, so every drain waited the full 30s timeout. At shutdown idle connections are closed, HTTP keep-alive connections finish their current request, new tunnels are refused so subscribers retry another node, and NAT'd nodes stop their reverse workers. Also fixes wait_zero missing the wakeup when the count reached zero just before it waited. ca.key and issued node.key are created 0600 (were 0644 under the default umask, letting any local user mint certs); stouter warns at startup when an existing key is readable by others. Config::save writes a temp file and renames it over the config, so a crash, kill or full disk can no longer leave a truncated file the daemon can't start from. It follows symlinks, keeps mode and owner, and falls back to an in-place write for single-file bind mounts and unwritable directories. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Utzq7EMn2utxnXNNXDfLSL
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.
Config poll loop no longer rolls back the cluster: a config file at a lower
version than memory is stale (persisting failed, e.g. a read-only mount),
not a manual edit. It used to be re-broadcast at a higher version, undoing
every change cluster-wide within 10s. The file is now ignored with a
warning, and every config change persists under the dynamic_config lock so
the file is always written in version order.
proxy_bidirectional: the idle timeout now means no data in either
direction for 5 minutes; each direction used to time out on its own, so a
one-way stream (download, log tail) was cut at 5 minutes. EOF in one
direction now half-closes the other side and keeps the opposite direction
running, so a client that shuts down its write side still gets the reply.
Graceful shutdown runs on SIGTERM as well as SIGINT (docker stop, systemd,
Kubernetes). It used to exit at once on SIGTERM, or ignore it as PID 1,
with no NodeLeave and no drain.
The drain counts only work in progress: tunnels, mux streams, gossip and
admin requests, and subscriber client connections (TCP, HTTP, upgrades).
Idle pooled connections and mux sessions used to count, so every drain
waited the full 30s timeout. At shutdown idle connections are closed, HTTP
keep-alive connections finish their current request, new tunnels are
refused so subscribers retry another node, and NAT'd nodes stop their
reverse workers. Also fixes wait_zero missing the wakeup when the count
reached zero just before it waited.
ca.key and issued node.key are created 0600 (were 0644 under the default
umask, letting any local user mint certs); stouter warns at startup when an
existing key is readable by others.
Config::save writes a temp file and renames it over the config, so a
crash, kill or full disk can no longer leave a truncated file the daemon
can't start from. It follows symlinks, keeps mode and owner, and falls back
to an in-place write for single-file bind mounts and unwritable
directories.
Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01Utzq7EMn2utxnXNNXDfLSL