Skip to content
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

EARLY_TRAPPER should set at Instance::call rather than Module::new #365

Closed
mikhailOK opened this issue Apr 18, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@mikhailOK
Copy link

mikhailOK commented Apr 18, 2019

Describe the bug

This logic:

    pub(crate) fn new(inner: Arc<ModuleInner>) -> Self {
        unsafe {
            EARLY_TRAPPER
                .with(|ucell| *ucell.get() = Some(inner.protected_caller.get_early_trapper()));
        }
        Module { inner }
    }

does not work correctly if a module is shared between threads or two modules are created and the first module is executed.

Additional context

Workaround: call Instance::module() before Instance::call() which will trigger Module::new() and set the thread-local

@mikhailOK mikhailOK added the bug Something isn't working label Apr 18, 2019
@lachlansneff
Copy link
Contributor

Hi, thanks for the bug report. I've created a pr that should fix the bug (#366). Let me know if it fixes the issue for you.

bors bot added a commit that referenced this issue Apr 18, 2019
366: Remove UserTrapper trait r=lachlansneff a=lachlansneff

This removes the `UserTrapper` trait and the thread_local EARLY_TRAPPER variable.

Fixes bug reported in #365.

Co-authored-by: Lachlan Sneff <[email protected]>
@syrusakbary
Copy link
Member

We just merged #366 into master. Closing the issue :)

Please let us know if you have any other issues

surban pushed a commit to rust-wasi-web/wwrr that referenced this issue Nov 9, 2024
…s--main--components--wasmer-sdk

chore(main): release wasmer-sdk 0.5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants