member-console start exits with status 0 when the web server fails to start #209

Open
opened 2026-10-09 16:03:03 +00:00 by cgalo5758 · 0 comments
Owner

What happens

member-console start stops with exit status 0 when the web server fails to start. This happens for every failure inside server.Start:

  • the session store (Valkey) does not answer;
  • the identity provider's discovery document cannot be read, or it publishes no end_session_endpoint;
  • an integration's routes fail to register;
  • a page handler fails to build;
  • the port is already taken.

The log ends with server failed to start and the error, and the process exits as if it had been asked to stop.

Every other boot failure in the same command exits 1: invalid configuration, the database, a stored config override, Temporal. Those branches in cmd/start.go call os.Exit(1). The server.Start error is only logged, and then Run returns. Cobra gets no error back, so Execute in cmd/root.go does not exit 1, and the process ends with status 0. Nothing shuts the server down gracefully, so server.Start only returns on a failure. An exit 0 from this path is never a clean stop.

What should happen

A failure to start the web server exits 1, like the other boot failures.

Where

cmd/start.go (the end of startCmd's Run, after server.Start); cmd/root.go (Execute); internal/server/server.go (Start).

Steps

  1. Start the console with its database reachable and Valkey stopped, or with --port set to a port another process holds.
  2. The log ends with server failed to start.
  3. echo $? prints 0.

Why it matters

A service manager that restarts on failure, such as systemd's Restart=on-failure or Docker's restart: on-failure, reads exit 0 as a deliberate stop and leaves the console down. A script or health check that tests the exit status reads the failed boot as success. #141 is the related boot-order bug: when Temporal answers and the identity provider does not, the console stops here, with status 0.

## What happens `member-console start` stops with exit status 0 when the web server fails to start. This happens for every failure inside `server.Start`: - the session store (Valkey) does not answer; - the identity provider's discovery document cannot be read, or it publishes no `end_session_endpoint`; - an integration's routes fail to register; - a page handler fails to build; - the port is already taken. The log ends with `server failed to start` and the error, and the process exits as if it had been asked to stop. Every other boot failure in the same command exits 1: invalid configuration, the database, a stored config override, Temporal. Those branches in `cmd/start.go` call `os.Exit(1)`. The `server.Start` error is only logged, and then `Run` returns. Cobra gets no error back, so `Execute` in `cmd/root.go` does not exit 1, and the process ends with status 0. Nothing shuts the server down gracefully, so `server.Start` only returns on a failure. An exit 0 from this path is never a clean stop. ## What should happen A failure to start the web server exits 1, like the other boot failures. ## Where `cmd/start.go` (the end of `startCmd`'s `Run`, after `server.Start`); `cmd/root.go` (`Execute`); `internal/server/server.go` (`Start`). ## Steps 1. Start the console with its database reachable and Valkey stopped, or with `--port` set to a port another process holds. 2. The log ends with `server failed to start`. 3. `echo $?` prints 0. ## Why it matters A service manager that restarts on failure, such as systemd's `Restart=on-failure` or Docker's `restart: on-failure`, reads exit 0 as a deliberate stop and leaves the console down. A script or health check that tests the exit status reads the failed boot as success. #141 is the related boot-order bug: when Temporal answers and the identity provider does not, the console stops here, with status 0.
cgalo5758 added the
kind
bug
area/ops
labels 2026-10-09 16:03:03 +00:00
Sign in to join this conversation.
No labels area/ops
kind
bug
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#209