Repository navigation
Stop the frontend tree when headless reflex run exits - #7328
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Merging this PR will improve performance by 4.36%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_route_argument_extraction |
120.8 µs | 115.8 µs | +4.36% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing flcrom:fix/headless-frontend-tree-shutdown (2a8c010) with main (5aafe47)
Footnotes
-
17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Could a maintainer rerun the Ubuntu 3.10 unit-test job? The Redis-enabled stage failed in |
FarhanAliRaza
left a comment
There was a problem hiding this comment.
I tested this PR with a small counter app, on this branch and on its merge base with main. A script started reflex run in its own session, with no TTY. It waited for the frontend and the backend, then sent a signal. After each signal, it recorded the processes that survived and the ports that stayed bound.
On main, SIGTERM and SIGINT did not stop the run. In frontend-only mode, SIGTERM stopped the Python process, but bun and node continued to run. On this branch, all of these cases exit with code 0, and no processes survive. The fix for #6980 works.
I also tested Ctrl+C in a PTY, SIGHUP, and SIGKILL of the process group. Ctrl+C works on both branches. SIGHUP hangs on both branches. SIGKILL of the process group is a regression: see the inline comments. In a browser, the app loads, state updates work, and hot reload works. The unit tests in this PR pass.
The requested changes are in the inline comments.
|
Thanks for the detailed review. I removed |
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="news/7328.bugfix.md">
<violation number="1" location="news/7328.bugfix.md:1">
P3: This PR now ships two news fragments for the same change. news/6980.bugfix.md (added in an earlier revision, named after the issue rather than the PR) is still present and its text — "stops its development frontend process group on shutdown" — describes the start_new_session approach that was removed in this PR, so the release changelog would get two near-duplicate bullets, one contradicting the shipped behavior. Delete news/6980.bugfix.md and keep this fragment.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
The follow-up commits through 36c0b2a cover the late-start/teardown race as well as the five review points. Could you take another look? |
6596431 to
8c06ecd
Compare
# Conflicts: # reflex/reflex.py # tests/units/test_reflex.py
tests/units/test_reflex.py: kept main's reflex-dev#7328 frontend-teardown tests, then this branch's test_compile_app_sets_start_method_before_compile_pool; both sides' imports kept. Claude-Session: https://claude.ai/code/session_01VDzz2un9mtjmCY24zSGmca
Closes #6980.
When the run unwinds,
_run_devterminates the frontend process. The frontend stays in the CLI process group, so a SIGKILL of the group also stops it. A frontend that launches after shutdown starts is terminated at launch. On POSIX, frontend-only mode exits cleanly on SIGTERM. This replaces #7209 with a smaller change.Tests: no-TTY subprocess cases for SIGTERM, SIGINT and SIGKILL in frontend-only and full-stack mode, plus a failing frontend task, a normal backend return and a late frontend launch. Windows descendant cleanup is not changed.