Worker output batches ignore the JSON envelope size, and a 413 is retried forever
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, distributed-systems
Research direction
Start with client/src/orcaster_worker/output_streamer.py, especially _peek_batch and _send_with_retry, then read client/src/orcaster_worker/api.py for response handling. Check the existing OutputStreamer tests and add coverage for batch limits, 413 splitting and single-event rejection; the issue also calls for a CHANGELOG entry under Unreleased. Done means bounded request bodies, ordered delivery, drained queue accounting, and no retry loop on an oversized event.
Written by the indexing model from the issue text.
Description
Problem
OutputStreamer._peek_batch limits a POST /v1/tasks/{id}/output batch by the sum of the UTF-8 bytes of the event texts (_DRAIN_BATCH_MAX_BYTES, 256 KiB; client/src/orcaster_worker/output_streamer.py:65, :119, :369-376). It does not count the JSON envelope of each event (seq, ts, stream, roughly 80 bytes). It also does not cap the number of events. The server schema does not cap the number of events per request either (server/orcaster_server/schemas/tasks.py:125).
A backlog of tiny events therefore makes a request body far larger than the 256 KiB budget suggests. For one-byte events the body is tens of MiB.
When the server answers 413, the worker does not treat it as permanent. _RETRY_STATUS does not contain 413 (client/src/orcaster_worker/api.py:35), and output() only maps 409 (api.py:362-364). The 413 becomes an exception, and _send_with_retry retries the same batch unchanged with backoff (output_streamer.py:401). Only a lost lease stops the loop. Events queued behind the batch are never delivered, and aclose() without a drain_deadline does not return.
The server limit for this route is MAX_OUTPUT_BODY_BYTES (server/orcaster_server/config.py:177, default 32 MiB).
Steps to reproduce
- A task writes unbuffered one-byte output.
- The worker builds a backlog of a few hundred thousand events (server unreachable for a while, or a refilled spill file).
- The next drain builds one very large batch.
- A server whose output body limit is lower than that batch answers 413. The worker retries the same batch forever.
Proposed change
- In
_peek_batch, charge each event its text size plus a fixed envelope allowance (for example 128 bytes). Keep the queue byte accounting (_dequeue,_queue_bytes) on the real text bytes so it does not drift. - Handle 413 explicitly:
- If the batch has more than one event, split it in half and send the halves in order.
- If a single event is rejected, log an error with the task id, the
seqand the encoded size (never the text), then continue with the next event. Never drop silently.
- Keep the server output limit unchanged in this issue.
Acceptance criteria
- A test feeds a few hundred thousand one-byte events through
OutputStreamerwith an API double. Every request body is below 4 MiB, every event is delivered exactly once, andseqorder is kept. - A test with events whose JSON escaping is longest (control characters) keeps every request body below 4 MiB.
- A test where the API double answers 413 above a size threshold shows the batch is split, all events are delivered, and
aclose()returns without adrain_deadline. - A test where the API double always answers 413 for one event shows an error log with task id and
seq, no event text in the log, and the rest of the stream delivered. -
_queue_bytesis 0 after a full drain that included a split. - Existing workers keep working. The server output limit and its default are not changed in this issue, and the request format on the wire is unchanged.
- CHANGELOG entry under Unreleased.
Open questions
- Lowering
MAX_OUTPUT_BODY_BYTESis out of scope. It should only be revisited once every deployed worker runs the fixed worker.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day