Skip to content

0.9.12a1 dev server: backend port stays bound and requests hang instead of being refused while no worker can serve (after #7114) #7213

Closed

Description

@masenf

Describe the bug

#7114 moved the dev backend's listening socket into the granian supervisor — ParentBoundGranian._init_shared_socket (reflex/utils/exec.py:726-741) builds it with SocketSpec(...).build() and sock.set_inheritable(True) — so the port stays bound across hot reloads. That part works as designed (600+ pings at 20 Hz across a live reload, none refused, max 166 ms). But whenever no worker is alive — the developer saved a file that raises at import, or a shutdown is wedged — the kernel keeps accepting connections into a queue nobody serves, and every request hangs for the client's full timeout. 0.9.11.post1 (no supervisor socket) refused instantly in the same situations; both versions recover once the file is fixed.

Dev-only (prod uses plain Granian, exec.py:857) and self-healing, but it turns fast failures into hangs. During testing this made several "the server is dead" reports look real when the worker was actually about to come back.

To Reproduce

  1. reflex run a blank app (dev) and wait for GET /ping → 200 on the backend port.
  2. Append raise RuntimeError("BOOM") to the app module and save it.
  3. GET /ping with a 6 s socket timeout at +10 s and +24 s.
  4. Remove the raise and probe again after ~12 s.
  • 0.9.12a1: TIMEOUT_NO_REPLY_6s at +10 s and +24 s (the connection is accepted, nothing answers); 200 again after the fix.
  • 0.9.11.post1: CONNECTION_REFUSED immediately at +10 s and +24 s; 200 again after the fix.

Raw-socket driver used for the numbers above: dev_server_cli/verification/scripts/break_reload_probe.py <venv> <appdir> <frontend-port> <backend-port> <label> <logdir>, run with granian 2.8.3 in both venvs so the only delta is reflex. The same state is reached with kill -TERM <reflex pid> (which neither version acts on when sent to the pid alone — separate issue) and with a module that raises at page-evaluation time.

Expected behavior

When no worker can serve, connections are refused (or answered with a 503) promptly instead of hanging until the client gives up.

Suggested fix shape

Keep #7114 but add a give-up path in ParentBoundGranian: refuse or 503 once no worker has come back within a bound, and release the socket when the supervisor itself is shutting down.

Specifics (please complete the following information):

  • Python Version: 3.11.15
  • Reflex Version: 0.9.12a1 (regression vs 0.9.11.post1); granian 2.8.3 in both environments
  • OS: Linux (Ubuntu 24.04 container)

Additional context

0.9.12a1 pre-release QA campaign FINDING-017, confirmed by an adversarial verifier on four port pairs. Evidence: prerelease-testing/2026-09-18-v0.9.12a1/dev_server_cli/ (logs/portprobe_*.json, verification/), and FINDINGS.md in the parent directory.

Activity

  1. added theissue type on Sep 19, 2026
  2. linear-code commented on Sep 19, 2026

    @linear-code
  3. added a commit that references this issue on Sep 21, 2026
    c78b76c
  4. added
    release-train
    on Nov 11, 2026
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

    release-train

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions