ChainSafe / ChainSafe/docker-socket-policy

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

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
Priority: P2 Type: Bug
Dominant language
Rust
Stars
2
Forks
0
Avg merge
5h 17m
Merged PRs (30d)
13

Description

## 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)
- [x] Go
- [x] 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.

Contributor guide

Open the contributing guide

Research direction

Start at go/main.go:62 and trace the listener startup paths in both the Go and Rust implementations, focusing on how bind failures are reported. Verify that individual listener failures remain independent, while zero successful binds produce an error and a prompt non-zero exit in each implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, rust
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.