Skip to content

Send a buffer to the file service in pieces - #201

Merged
splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:piecewise-file-service-body
Dec 3, 2026
Merged

splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:piecewise-file-service-body

Conversation

@splitbrain-bot

Copy link
Copy Markdown

An attachment upload failed with Internal error when the user attached two files to one prompt and one of them was larger than about 10 MiB. The prompt was then not sent. A second try worked, because the composer uploaded only the failed file again.

Cause: The orchestrator uses one HTTP/2 session for each box and gave each buffer body to it as a whole. Node.js limits the memory of a session to 10 MB by default. While a larger buffer waited in the session, the session refused each new request with NGHTTP2_ENHANCE_YOUR_CALM. The dashboard uploads the attachments of a prompt in parallel, so a request for the other file was refused. The error handler reported the refusal as a 500.

Changes:

  • FileService.send sends a buffer body in pieces of 64 KiB and waits when the session is full. This applies to each request with a buffer body, not only to attachments.

Limits:

  • The file service in the box is the same, so the box images need no change.

Tests:

  • files.test.ts checks that a 1 MiB file is stored while a 14 MiB file is sent on the same connection. The test failed in each run before the change.

An attachment upload failed with "Internal error" when the user attached two files to one prompt and one of them was
larger than about 10 MiB. The orchestrator gave each buffer to the HTTP/2 session of the box as a whole. Node.js limits
the memory of a session to 10 MB by default, and the session refused each new request while a larger buffer waited in
it. The dashboard uploads the attachments of a prompt in parallel, so a request for the other file was refused.

The orchestrator now sends a buffer in pieces of 64 KiB and waits when the session is full.
@splitbrain
splitbrain merged commit 8fd3801 into splitbrain:main Dec 3, 2026
5 checks passed
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.

2 participants