Each of the 4 backend processes has its own independent rotation state — "View now" / "Now displaying" silently target the wrong process on any LAN port #1
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
paul_loth/krautspaceTV#1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
backend/rotation.pykeeps rotation state (STATE = RotationState(), current slide id, forced-slide requests, "now displaying" info) as an in-process, module-level singleton, andbackend/app.py'slifespan()starts its ownasyncio.create_task(rotation_loop())per process.We run four separate
uvicornprocesses (see README architecture table):backend.service(127.0.0.1:8081, kiosk-internal),backend-http.service(0.0.0.0:80),backend-tls.service(0.0.0.0:8080),backend-tls-443.service(0.0.0.0:443). Each is a fully independent OS process/Python interpreter, so each one has its own separateRotationStateinstance and its own independent rotation loop, all reading the same SQLite DB on the same schedule but never sharing in-memory state with each other.The kiosk display itself only ever polls
http://127.0.0.1:8081/api/slide/current— i.e. onlybackend.service's rotation loop actually drives what's on the TV.Impact
STATE.request_forced()on that process'sSTATE— which has no effect on the actual display, since the display polls a completely different process's state.is_available()/render()HTTP calls) happens 4x redundantly, once per process, every rotation cycle.Suggested fix
Move rotation state out of process memory and into something shared across all four processes — e.g. back it with the SQLite DB (already shared), or run a single rotation-owning process and have the other three become thin proxies to it (e.g. over a local socket/HTTP call to the 8081 instance), or collapse to a single process serving multiple ports via an ASGI server capable of multi-bind (if feasible) instead of 4 separate processes.
Fixed in
8835778: only the kiosk-internal process (127.0.0.1:8081, env SIGNAGE_ROTATION_OWNER=1) now runs the rotation loop; the other 3 processes forward /api/slide/current reads and /admin/slides/{id}/view-now writes to it over loopback HTTP. Verified live: a view-now POST sent to port 80 is now reflected identically on port 8081. Also took the opportunity to move the admin UI from /admin to / and the kiosk display from / to /display, per discussion.