You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@theduke made a little demo where we load an image and pass it to runWasix() as stdin. The WASI program then does a std::io::stdin().read_to_end() so it can receive the image and resize it. The code looks something like this:
However, no matter what image we passed in, we always seemed to trigger a panic/OOM in the instance, which would then abort with an unreachable instruction.
After modifying the WASI program to read std::io::stdin() in chunks, I discovered that every read seems to get the same data rather than reading successive bytes from the input until EOF is reached.
I noticed this was broken around the same time TTY handling was fixed (maybe somewhere around 8b5d439), but I pretended the problem wasn't there by only writing tests that do instance.stdin.write()... Looks like that laziness has come back to bite me 😅
Michael-F-Bryan
changed the title
Providing stdin up front seems to always read the same bytes
[SDK-38] Providing stdin up front seems to always read the same bytes
Dec 14, 2023
@theduke made a little demo where we load an image and pass it to
runWasix()
asstdin
. The WASI program then does astd::io::stdin().read_to_end()
so it can receive the image and resize it. The code looks something like this:However, no matter what image we passed in, we always seemed to trigger a panic/OOM in the instance, which would then abort with an
unreachable
instruction.After modifying the WASI program to read
std::io::stdin()
in chunks, I discovered that every read seems to get the same data rather than reading successive bytes from the input until EOF is reached.I noticed this was broken around the same time TTY handling was fixed (maybe somewhere around 8b5d439), but I pretended the problem wasn't there by only writing tests that do
instance.stdin.write()
... Looks like that laziness has come back to bite me 😅SDK-38
The text was updated successfully, but these errors were encountered: