alexcrichton requested wasmtime-core-reviewers for a review on PR #8782.
alexcrichton requested fitzgen for a review on PR #8782.
alexcrichton opened PR #8782 from alexcrichton:fix-deadlock
to bytecodealliance:main
:
This commit fixes a bug in the
Subscribe
trait implementation forAsyncStd{in,out}Stream
structures in thewasmtime-wasi
crate. Previously these implementations would create a future for the duration of a singlepoll
but then the future was dropped which could lead to lost wakeups as the waker is gone after the future is dropped. The fix was to use atokio::sync::Mutex
here instead of astd::sync::Mutex
and leave some comments about why contention isn't expected.Closes #8781
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
pchickey submitted PR review.
pchickey created PR review comment:
I'd be more comfortable with this test if the amount read was in excess of the buffer sizes in the io::duplex and the AsyncWriteStream. You could just lower those to 32 each.
pchickey submitted PR review:
Great catch. Thank you!
alexcrichton updated PR #8782.
alexcrichton has enabled auto merge for PR #8782.
alexcrichton merged PR #8782.
coolreader18 commented on PR #8782:
Why not just use
tokio::sync::Mutex::blocking_lock()
?
alexcrichton commented on PR #8782:
Semantically these are all non-blocking functions, not blocking ones, so blocking on contention isn't appropriate for them.
Last updated: Nov 22 2024 at 17:03 UTC