Skip to content

fix: the package proxy is healthy only when its serving loop answers - #100

Merged
alexeybe1kin merged 1 commit into
mainfrom
fix/proxy-health
Nov 13, 2026
Merged

alexeybe1kin merged 1 commit into
mainfrom
fix/proxy-health

Conversation

@alexeybe1kin

Copy link
Copy Markdown
Collaborator

Hunt toolgate-4 F20. proxy.health() returned 0 whenever the socket file existed, so a hung proxy or a socket file left by a crash read as healthy.

Now it connects, sends one request line, and waits up to 5 s for any answer or close. A sandbox client gets an HTTP reply. Any other peer (the health check usually runs as the proxy's own user) has its connection closed by the peer check, which counts as alive. A stale socket refuses the connection and a hung loop times out: both are unhealthy. The peer check (verify_request) is unchanged.

Tests (toolgate/tests/test_sandbox_proxy.py, POSIX only): no socket; a stale socket file; a listener that never accepts; a live proxy for a client and for a non-client. Run under WSL: 8 passed on the branch, and on main the stale-socket and hung-loop tests fail. ruff ok, types ok.

Its health check only tested that the socket file exists, so a hung proxy or
a socket file left by a crash read as healthy (hunt toolgate-4 F20). It now
connects and waits up to 5 s for an answer; the peer check closing a
non-client counts as one, and the peer check itself is unchanged.
@alexeybe1kin
alexeybe1kin merged commit bfd41b7 into main Nov 13, 2026
4 checks passed
@alexeybe1kin
alexeybe1kin deleted the fix/proxy-health branch November 13, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant