-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESPIPE
errors unless --wasi threads=y
is specified in wasmtime 15 and 16
#7813
Comments
Under the hood this toggles the What you're probably seeing here is an unintended difference in the implementation between the two and a bug we need to fix (thanks for filing!). Would you be able to capture some extra logging to help debug a bit? Could you set |
😆 definitely wouldn't have guessed that's how you force falling back to preview1.
Of course! You all have always been prompt and friendly when I run into issues trying to get Python working w/ WASI.
It did! I also downloaded v15.0.1 and 14.0.4 and the issue is in 15 but not 14 (I'll update the opening comment accordingly). I have downgraded the buildbot I'm using to test CPython to 14.0.4 and the results will hopefully show a pass in https://buildbot.python.org/all/#/builders/1046/builds/4082 . |
ESPIPE
errors unless --wasi threads=y
is specifiedESPIPE
errors unless --wasi threads=y
is specified in wasmtime 15 and 16
oh for Also the 14/15 split makes sense, that's when the switch in the defaults happened (release notes) |
This was all under wasmtime 16; I validated separately about 14.0.4.
It was a typo in the directive on my end. 😅 Sorry about that! |
Ah ok, makes sense. I'm having difficulty reproducing in that I can't get a build to work it seems. My system's stock python seems too old since it prints:
Using 3.11 (as opposed to my 3.10) got further however (after installing wasi-sdk-21.0):
I edited the
Do you perhaps have a I do notice though that in the failure logs I'm seeing a lot of:
whereas the success logs do not have that. That makes me think we're leaking something somewhere by accident. I don't think we're leaking through WASI fds since it stays around 4 for newly opened fds but my guess is that we have some Could you run |
Aha it appears that this panics after 1k iterations: fn main() {
for i in 0.. {
std::fs::read("foo.rs").unwrap();
if i % 100 == 0 {
println!("{i}");
}
}
} so I think we found at least one culprit |
Previously temporary streams created as part of the preview1 adapter in the wasmtime-wasi crate were left open which meant that they continued to occupy space in the resource table and the underlying file accidentally wasn't ever actually closed. cc bytecodealliance#7813
Previously temporary streams created as part of the preview1 adapter in the wasmtime-wasi crate were left open which meant that they continued to occupy space in the resource table and the underlying file accidentally wasn't ever actually closed. cc bytecodealliance#7813
Could you try #7816 and see if it resolves the issue? If not I can keep digging and see if there's still places we forgot to close things. |
Previously temporary streams created as part of the preview1 adapter in the wasmtime-wasi crate were left open which meant that they continued to occupy space in the resource table and the underlying file accidentally wasn't ever actually closed. cc bytecodealliance#7813
Previously temporary streams created as part of the preview1 adapter in the wasmtime-wasi crate were left open which meant that they continued to occupy space in the resource table and the underlying file accidentally wasn't ever actually closed. cc #7813
Previously temporary streams created as part of the preview1 adapter in the wasmtime-wasi crate were left open which meant that they continued to occupy space in the resource table and the underlying file accidentally wasn't ever actually closed. cc #7813
I should be able to test the PR today or tomorrow (although based on how today is going, most likely tomorrow). |
Wasmtime 17 is also released with the above fix which may make getting a binary easier |
Wasmtime 17 fixed it! Now to file the other bugs I found. 😅 |
Test Case
Various CPython test cases have started failing when moving from wasmtime 13 to 16 due to
ESPIPE
. Adding--wasi threads=y
fixes the issue which seems unrelated to file seeking.Example failure run can be seen at https://buildbot.python.org/all/#/builders/1124/builds/640/steps/11/logs/stdio right after I switched to wasmtime 16 from 13 (wasmtime 14.0.4 does not seem to have the issue).
Steps to Reproduce
git clone https://github.com/python/cpython.git
cd cpython
python3 Tools/wasm/wasi.py build
cross-build/wasm32-wasi/python.sh
and remove--wasi threads=y
./cross-build/wasm32-wasi/python.sh -m test test___all__
You can also try test___all__ test_bufio test_compileall test_dbm_dumb test_importlib test_io test_marshal test_pathlib test_posix test_runpy test_tarfile test_zipfile .
Expected Results
The test should pass w/o issue (it was working fine under wasmtime 13 w/ e.g.
wasmtime run --env PYTHONPATH=/builddir/wasi/build/lib.wasi-wasm32-3.12:/Lib --mapdir /::/home/brettcannon/Repositories/python/cpython-3.12 -- python.wasm
.Actual Results
W/o
--wasi threads=y
, it causes aESPIPE
.Versions and Environment
Wasmtime version or commit: 16.0.0 and 15.0.1
Operating system: Linux
Architecture: x64
Extra Info
WASI-SDK 20.
The text was updated successfully, but these errors were encountered: