TartanLlama opened PR #12736 from TartanLlama:sy/future-stream-thread to bytecodealliance:main:
The current thread is not set before lowering the results of stream/future reads, which can potentially call
realloc.Putting this up as a draft for now as I'm off tomorrow, will add some tests for this on Monday.
github-actions[bot] added the label wasmtime:api on PR #12736.
alexcrichton submitted PR review:
Longer-term (@dicej you may have thoughts on this too) I feel like the juggling here is pretty brittle and it seems like we should have a new argument to
LowerContext::newor something like that. I'm not sure if that would work well given all the various juggling involved, but might be something worth considering.
alexcrichton created PR review comment:
I think this argument is always
self.concurrent_state_mut().current_guest_thread()?, so could the argument be dropped and that inlined directly below?
alexcrichton created PR review comment:
Mind leaving comments here, and above, for why the current thread is set?
Also, is this something where we want to restore the previous thread after this finishes?
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
TartanLlama edited PR #12736:
The current thread is not set before lowering the results of stream/future reads, which can potentially call
realloc.
TartanLlama has marked PR #12736 as ready for review.
TartanLlama requested pchickey for a review on PR #12736.
TartanLlama requested wasmtime-core-reviewers for a review on PR #12736.
TartanLlama updated PR #12736.
TartanLlama updated PR #12736.
alexcrichton added PR #12736 Set current thread before lowering stream/future reads to the merge queue.
alexcrichton merged PR #12736.
alexcrichton removed PR #12736 Set current thread before lowering stream/future reads from the merge queue.
Last updated: Mar 23 2026 at 16:19 UTC