Skip to content

Add configuration for buffer sizes in WASI - #15095

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:add-a-dknob
Nov 3, 2026
Merged

alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:add-a-dknob

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit adds a configuration knob on WasiCtxBuilder to control the default and maximum sizes of buffers used throughout wasmtime-wasi where necessary. These sizes have historically been limited in the past to ensure that guest memory usage is capped but this can cause real-world programs to break such as in WebAssembly/wasi-libc#894 where Python expects a write with a large size to succeed all in one go and doesn't internally have a retry loop for remaining bytes.

The default value of 64KiB is not changed in this commit, but the wasmtime CLI now has a default buffer size of 2MiB to work with more programs by default.

This commit adds a configuration knob on `WasiCtxBuilder` to control the
default and maximum sizes of buffers used throughout wasmtime-wasi where
necessary. These sizes have historically been limited in the past to
ensure that guest memory usage is capped but this can cause real-world
programs to break such as in WebAssembly/wasi-libc#894 where Python
expects a `write` with a large size to succeed all in one go and doesn't
internally have a retry loop for remaining bytes.

The default value of 64KiB is not changed in this commit, but the
`wasmtime` CLI now has a default buffer size of 2MiB to work with more
programs by default.
@alexcrichton
alexcrichton requested review from a team as code owners October 30, 2026 19:50
@alexcrichton
alexcrichton requested review from fitzgen and rvolosatovs and removed request for a team October 30, 2026 19:50
@github-actions github-actions Bot added the wasi Issues pertaining to WASI label Oct 30, 2026
@fitzgen
fitzgen added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Nov 3, 2026
Merged via the queue into bytecodealliance:main with commit 235cede Nov 3, 2026
53 checks passed
@alexcrichton
alexcrichton deleted the add-a-dknob branch November 3, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants