Skip to content

Conversation

@StackOverflowExcept1on
Copy link
Contributor

@StackOverflowExcept1on StackOverflowExcept1on commented Sep 28, 2025

Description

Resolves #5721

See #5746

@syrusakbary
Copy link
Member

Thanks for the PR.
As @Amanieu commented on the original issue we would need to use the ScopedCoroutine when upgrading to 0.3.0
#5721 (comment)

@StackOverflowExcept1on
Copy link
Contributor Author

@syrusakbary thx for quick reply!

    Checking wasmer-vm v6.1.0-rc.5 (/mnt/tmpfs/wasmer/lib/vm)
error[E0597]: `stack` does not live long enough
   --> lib/vm/src/trap/traphandlers.rs:953:48
    |
950 |       let mut stack = scopeguard::guard(stack, |stack| STACK_POOL.push(stack));
    |           --------- binding `stack` declared here
...
953 |       let mut coro = Coroutine::with_stack(&mut *stack, move |yielder, ()| {
    |                      -                           ^^^^^ borrowed value does not live long enough
    |  ____________________|
    | |
954 | |         // Save the yielder to TLS so that it can be used later.
955 | |         YIELDER.with(|cell| cell.set(Some(yielder.into())));
...   |
958 | |     });
    | |______- argument requires that `stack` is borrowed for `'static`
...
980 |   }
    |   - `stack` dropped here while still borrowed

For more information about this error, try `rustc --explain E0597`.
error: could not compile `wasmer-vm` (lib) due to 1 previous error

looks like we also need to fix stack caching somehow

@StackOverflowExcept1on
Copy link
Contributor Author

@syrusakbary done! I checked API changes in benchmarks here: Amanieu/corosensei#58, Amanieu/corosensei#60.

@syrusakbary
Copy link
Member

syrusakbary commented Sep 29, 2025

In general it looks good to me (I wonder if it might be better to do coro.scope inside the Trap handler instead of outside). @Amanieu I'd love to hear your thoughts!

Note: the tests failing have nothing to do with the code changes from this PR

@Amanieu
Copy link
Contributor

Amanieu commented Sep 29, 2025

It makes no difference, the scope is just there to ensure the coroutine is properly dropped at the end of the scope. This code is fine as it is.

@syrusakbary syrusakbary merged commit 061fee9 into wasmerio:main Sep 29, 2025
87 of 93 checks passed
@StackOverflowExcept1on StackOverflowExcept1on deleted the update-corosensei branch October 3, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to link against static Linux Wasmer lib

3 participants