Repository navigation
wiretap v0.5.2
Bounded graceful shutdown for both the relay and client, with worker ownership and database-close-last safety.
Relay restart safety
On SIGINT/SIGTERM the relay rejects new work and gives accepted HTTP requests up to five seconds to finish. It closes upgraded WebSocket tunnels and joins delivery and ACK/read workers before closing SQLite, including connections still waiting for HELLO. Serve failures use the same bounded cleanup.
Expired drains cancel request contexts and force-close sockets, followed by a one-second final join allowance. Committed webhooks remain durable and resume after reconnect; local inserts are idempotent when an unacknowledged row is delivered again. This improves restart safety, not zero downtime.
Client and interception cleanup
- Desktop/TUI app shutdown stops new operations, bounds tunnel termination, joins the relay writer, and tracks replay, automatic forwarding, scripts, and store work.
- Interception drains accepted HTTP/CONNECT exchanges and control API handlers before closing its owned store. Stalled sockets and upstream I/O are interrupted at the deadline.
- Shell startup patches and override wrappers are cleaned even after a network drain timeout. Session history finalization has its own one-second deadline.
- GUI, TUI, and interception cleanup failures are logged/returned instead of discarded. TUI handles SIGINT/SIGTERM through cancellation and terminal cleanup.
- If a worker ignores cancellation, shutdown reports an error and leaves its store open rather than closing it underneath active work.
Upgrade notes
Restart both relay and clients; no new database or tunnel-protocol migration is needed. Allow at least seven seconds for relay termination and eight seconds for interception before sending SIGKILL. SIGKILL and abrupt power loss cannot run cleanup.
Requests exceeding the drain budget may be interrupted. Upstream side effects may already have happened; Wiretap does not automatically retry those requests. Client diagnostic files remain command-specific; unified client logging is deferred.
Validation
The full race-enabled shuffled Go suite, repeated shutdown regression tests, Go vet, production GTK3 GUI compilation, documentation build, and diff checks passed. Tests cover accepted-work draining, forced cancellation, active CONNECT, pre-HELLO tunnels, expired-deadline shell cleanup, store-close-last behavior, and committed webhook resume across restart.
Live GUI/TUI/shell signal smoke checks remain manual; GUI compilation was verified, not a live visual session.