Stream: git-wasmtime

Topic: wasmtime / PR #8782 Fix lost `Waker` instances with async...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 16:30):

alexcrichton requested wasmtime-core-reviewers for a review on PR #8782.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 16:30):

alexcrichton requested fitzgen for a review on PR #8782.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 16:30):

alexcrichton opened PR #8782 from alexcrichton:fix-deadlock to bytecodealliance:main:

This commit fixes a bug in the Subscribe trait implementation for AsyncStd{in,out}Stream structures in the wasmtime-wasi crate. Previously these implementations would create a future for the duration of a single poll 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 a tokio::sync::Mutex here instead of a std::sync::Mutex and leave some comments about why contention isn't expected.

Closes #8781

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 19:59):

pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 19:59):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 19:59):

pchickey submitted PR review:

Great catch. Thank you!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 20:07):

alexcrichton updated PR #8782.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 20:07):

alexcrichton has enabled auto merge for PR #8782.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2024 at 20:31):

alexcrichton merged PR #8782.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 22 2024 at 22:42):

coolreader18 commented on PR #8782:

Why not just use tokio::sync::Mutex::blocking_lock()?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 23 2024 at 14:35):

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