Skip to content

tls::get runtime panic #11412

Closed
Closed

Description

@rvolosatovs

Test Case

While working on wasip3 wasi:filesystem I've encountered a panic in 5438472

Steps to Reproduce

  • checkout 5438472
  • run wasmtime_wasi tests with p3 feature enabled

Expected Results

If the issue is in the wasi:filesystem implementation, i.e. the wasmtime API usage I'd ideally expect a compile-time error. If that's not possible, I'd expect a clearer error message as to what's wrong. If the implementation is correct, I'd not expect a panic.

Actual Results

thread 'p3::p3_filesystem_file_read_write' panicked at crates/wasmtime/src/runtime/component/concurrent/tls.rs:81:5:
attempted to recursively call `tls::get` when the pointer was not present or already taken by a previous call to `tls::get`

Versions and Environment

Wasmtime version or commit: 5438472

Operating system: macOS

Architecture: aarch64

Activity

  1. added
    bug
    on Aug 11, 2025
  2. rvolosatovs commented on Aug 11, 2025

    @rvolosatovs
    MemberAuthor

    FWIW, I've just tested #11374 and it did not fix the issue

  3. alexcrichton commented on Aug 11, 2025

    @alexcrichton
    Member

    This is happening due to this panic condition. Effectively this line enters a with but store.get_file(&fd)? a few lines down also calls self.with, hence the recursive access.

    This is more-or-less a known footgun with Accessor, and I'm not sure how to design something that statically avoids it. I have an idea for improving the error message though.

  4. added 2 commits that reference this issue on Aug 11, 2025
    9129b0c
    911e6fc
  5. added a commit that references this issue on Aug 11, 2025
    8b68f6f
  6. added a commit that references this issue on Oct 20, 2025
    217b99f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions