fix(axelera): overload submits degrade to zero-rows, not raise

When the input queue is full, drop the frame's INFERENCE but keep the
1 submission : 1 result contract of AsyncDetectorRunner by emitting an
empty (20, 6) result for that connection_id (same pattern the producer
already uses when the buffer pool is starved). Raising here used to let a
burst of offered frames kill the detect worker and force a restart.
Test flipped: queue-full now asserts the zero-row drop instead of the raise.
This commit is contained in:
patrykorwat 2026-08-24 10:44:10 +00:00
parent 97705e7df2
commit 410696ade3

View File

@ -424,13 +424,23 @@ class _AxeleraRuntimeInference:
# -- public contract used by AxeleraDetector --------------------------
def submit(self, connection_id: str, frame: np.ndarray) -> None:
"""Queue one frame for inference, owned by `connection_id`."""
"""Queue one frame for inference, owned by `connection_id`.
On overload (input queue full) the frame's INFERENCE is dropped but a
zero-row result is still emitted for `connection_id`: the async runner
contract is strictly 1 submission : 1 result (SHM cleanup + timing
pairing), so raising here would leave the runner waiting for a result
that never arrives.
"""
try:
self._frame_q.put_nowait((connection_id, frame))
except queue.Full:
raise RuntimeError(
"Axelera inference queue is full; restart required."
) from None
logger.warning(
"axelera: inference queue full; dropping frame for %s",
connection_id,
)
self._push_result(connection_id, np.zeros((MAX_ROWS, 6), np.float32))
return
self._ensure_threads()
def _ensure_threads(self) -> None: