Skip to content

Process exits 0 (Rust) / hangs (Go) when all listeners fail to bind — defeats Restart=on-failure #30

Description

@abienkowski

Summary

If every listener fails to bind (e.g. bad --listen-tcp address plus missing parent directory for --listen-socket), the process ends up serving nothing, but neither implementation signals failure usefully:

  • Rust: both listener tasks log an error and return; main exits with code 0. Under systemd Restart=on-failure, nothing restarts a proxy that serves nothing.
  • Go: startListener logs and returns for each failed listener, but main then blocks on <-ctx.Done() forever (go/main.go:62) — the process looks alive to the supervisor while serving nothing.

Per-listener independent failure is intentional (one listener failing shouldn't kill the other — matches both implementations). The bug is only the all-listeners-failed terminal state.

Affected implementation(s)

  • Go
  • Rust
  • TypeScript (single TCP listener only; worth confirming it exits non-zero on bind failure)

Expected behavior

If zero listeners bound successfully, exit promptly with a non-zero status so a supervisor (Restart=on-failure) restarts it and operators see a failed unit instead of a healthy-looking zombie.

Suggested fix

Have each listener task report whether it bound successfully; after startup (or after all tasks finish), if none bound, log an error and exit(1). Same pattern in both Go and Rust.

Context

Split out from the review follow-ups on PR #27. Related: #25.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P2Added to issues and PRs relating to a medium severity bugs.Type: BugAdded to issues and PRs if they are addressing a bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions