Skip to content

Backgrounded/no-TTY reflex run ignores SIGTERM/SIGINT — requires SIGKILL of the process group #6980

Description

@masenf

Describe the bug

When reflex run is started without a controlling TTY (backgrounded under setsid with output redirected — the shape of CI jobs, containers, and process supervisors), it does not exit on SIGTERM or SIGINT. The only reliable way to stop it is SIGKILL of the whole process group. Since systemd/docker/k8s stop services with SIGTERM, this means no graceful shutdown in exactly the environments that rely on it.

To Reproduce

reflex init --template blank
setsid reflex run --frontend-port 3140 --backend-port 8140 > server.log 2>&1 &
# wait for the app to come up, then:
kill -TERM <reflex pid>     # process keeps running
kill -INT <reflex pid>      # still running
kill -KILL -- -<pgid>       # only this stops it (note: the launcher pid and the setsid pgid differ)

Observed behavior

The server (and its bun/node frontend children) keeps running after SIGTERM and SIGINT; SIGKILL of the process group is required. Observed consistently across many independent app runs during pre-release testing (Linux container, dev mode).

Expected behavior

SIGTERM/SIGINT terminate reflex run (and its child process tree) promptly and gracefully regardless of whether a TTY is attached.

Specifics (please complete the following information):

  • Python Version: 3.11
  • Reflex Version: 0.9.9a1
  • OS: linux

Additional context

  • The same no-TTY launch recipe was used for 0.9.8 baseline runs in the same environment with the same result, so this does not appear to be a 0.9.9a1 regression.
  • Related but distinct: interactive (TTY-attached) reflex run does shut down on SIGTERM — that path instead logs spurious ERROR records on shutdown (filed separately).
  • Found during 0.9.9a1 pre-release testing; rerun instructions documenting the SIGKILL requirement are on branch claude/reflex-prerelease-testing-t0sd90 under prerelease-testing/2026-08-27-v0.9.9a1/up_upload_clock/.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions