Cancellation latency regression in /v1/digitize (2.04s vs 2.0s budget) #126

Closed
opened 2026-09-08 19:08:11 +00:00 by Mark · 0 comments
Owner

Cancellation latency regression in /v1/digitize

Repo: Mark/easystitch
Severity: Low (test-only regression, but deterministic)
Found: 2026-09-08 full shakedown

Symptom

tests/test_service_digitize.py::test_digitize_cancellation_on_disconnect_returns_within_one_second
asserts cancellation returns within 2.0s. It now consistently takes 2.04–2.05s — 40–50ms
over budget, every run, not flaky.

Test budget comment (line 167): Budget: 50 ms poll cadence + stage-boundary check + buffer.

Why it matters

This is the contract that /v1/digitize cancels a running pipeline when the HTTP client
disconnects. Slow cancellation ties up a thread-pool slot for an extra second per abandoned
request — at 5 concurrent digitizes on a 4-core box, that's a 25% utilization loss under
flaky-client conditions.

Likely location

  • pipeline_runner.py — the cancellation check loop's poll interval
  • Or main_pipeline.py — the cancel_event check inside the engine's stage loop

Acceptance

  • test_digitize_cancellation_on_disconnect_returns_within_one_second passes
  • No other test regresses
## Cancellation latency regression in /v1/digitize **Repo:** Mark/easystitch **Severity:** Low (test-only regression, but deterministic) **Found:** 2026-09-08 full shakedown ### Symptom `tests/test_service_digitize.py::test_digitize_cancellation_on_disconnect_returns_within_one_second` asserts cancellation returns within 2.0s. It now consistently takes **2.04–2.05s** — 40–50ms over budget, every run, not flaky. Test budget comment (line 167): `Budget: 50 ms poll cadence + stage-boundary check + buffer.` ### Why it matters This is the contract that `/v1/digitize` cancels a running pipeline when the HTTP client disconnects. Slow cancellation ties up a thread-pool slot for an extra second per abandoned request — at 5 concurrent digitizes on a 4-core box, that's a 25% utilization loss under flaky-client conditions. ### Likely location - `pipeline_runner.py` — the cancellation check loop's poll interval - Or `main_pipeline.py` — the cancel_event check inside the engine's stage loop ### Acceptance - `test_digitize_cancellation_on_disconnect_returns_within_one_second` passes - No other test regresses
Mark 2026-09-08 19:08:11 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#126
No description provided.