Skip to content

wasip3: Improve/fix handling of buffered reads#793

Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom
alexcrichton:fix-buffered-reads
Apr 22, 2026
Merged

wasip3: Improve/fix handling of buffered reads#793
alexcrichton merged 1 commit intoWebAssembly:mainfrom
alexcrichton:fix-buffered-reads

Conversation

@alexcrichton
Copy link
Copy Markdown
Collaborator

This updates the code path that performs a buffered read for a stream when zero-length reads/writes are determined to not signal readiness correctly. Specifically a defensive assertion that this is a nonzero-length read is added and additionally in the case that I/O completes immediately the return code is handled appropriately. Unfortunately I don't know of a way to test this as it's not testable from Wasmtime today and the file streams implementation in Wasmtime ends up sort of accidentally respecting the zero-length protocol (sort of). Thus, for now, this is just a code change until more comprehensive testing such as #766 is implemented.

This updates the code path that performs a buffered read for a stream
when zero-length reads/writes are determined to not signal readiness
correctly. Specifically a defensive assertion that this is a
nonzero-length read is added and additionally in the case that I/O
completes immediately the return code is handled appropriately.
Unfortunately I don't know of a way to test this as it's not testable
from Wasmtime today and the file streams implementation in Wasmtime ends
up sort of accidentally respecting the zero-length protocol (sort of).
Thus, for now, this is just a code change until more comprehensive
testing such as WebAssembly#766 is implemented.
@alexcrichton alexcrichton requested a review from dicej April 21, 2026 21:33
@alexcrichton alexcrichton merged commit d381a1f into WebAssembly:main Apr 22, 2026
33 checks passed
@alexcrichton alexcrichton deleted the fix-buffered-reads branch April 22, 2026 14:09
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