You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
0.9.12a1 dev server: backend port stays bound and requests hang instead of being refused while no worker can serve (after #7114) #7213
#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
reflex run a blank app (dev) and wait for GET /ping → 200 on the backend port.
Append raise RuntimeError("BOOM") to the app module and save it.
GET /ping with a 6 s socket timeout at +10 s and +24 s.
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
linear-code commentedon Sep 19, 2026
ENG-12566
prerelease-testing: 0.9.12a1 — f001 and f017 fix reports and evidence (…
fix: release the dev backend socket when no worker can serve it
fix: release the dev backend socket when no worker can serve it (refl…