Skip to content

Fix secondary app signals in spawned workers - #3180

Open
bm1016bm-svg wants to merge 2 commits into
sanic-org:mainfrom
bm1016bm-svg:codex/fix-3179-secondary-app-passthru
Open

Fix secondary app signals in spawned workers#3180
bm1016bm-svg wants to merge 2 commits into
sanic-org:mainfrom
bm1016bm-svg:codex/fix-3179-secondary-app-passthru

Conversation

@bm1016bm-svg

Copy link
Copy Markdown

Summary

  • preserve each registered app's runtime state when configuring spawned workers
  • refresh secondary apps before their servers start
  • verify dev-mode built-in HTTP signals remain available on secondary apps

Why

In spawn mode, the primary app received its prepared state through passthru, but secondary apps were re-imported without their per-app mode and config. A secondary app prepared with dev=True could therefore start with production touchups enabled and fail to resolve built-in HTTP lifecycle signals.

Validation

  • python -m pytest tests/worker/test_worker_serve.py tests/worker/test_startup.py -q — 19 passed, 1 skipped
  • python -m ruff check sanic/mixins/startup.py sanic/worker/serve.py tests/worker/test_worker_serve.py
  • python -m ruff format --check sanic/mixins/startup.py sanic/worker/serve.py tests/worker/test_worker_serve.py
  • git diff --check

Fixes #3179

@bm1016bm-svg
bm1016bm-svg marked this pull request as ready for review July 29, 2026 05:10
@bm1016bm-svg
bm1016bm-svg requested a review from a team as a code owner July 29, 2026 05:10
@bm1016bm-svg

Copy link
Copy Markdown
Author

CI failures appear unrelated to this change: the worker regression suite passes locally (11/11), while the failing type check is in sanic/pages/error.py and coverage fails in the uvicorn/websockets test environment. Recent main-branch Tests/Coverage runs are also failing. I cannot rerun the workflows without repository admin permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Secondary apps lack built-in HTTP signals (NotFound error) when receiving requests in spawn / dev mode

1 participant