tokio 1.54 multi-thread spawn panics: "failed to resolve instance for ShardedListItem::get_shard_id"

Open
#250 7 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@kioku is already working on this.

Since Nov 22, 2026.

  • #258 by @ariymarkowitz — closed without merging
  • #259 by @kioku — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
compilers

Research direction

Start with the reproducer in Cargo.toml and src/main.rs, then trace Relax’s instance resolution from libs/relax/types/src/instance.rs:238 against Tokio’s call at src/util/sharded_list.rs:91 and the trait and impl in src/runtime/task/mod.rs:627. Compare the Tokio case with the std-only trait-shaped example described in the issue to isolate the trigger. Done means the reproducer prints 42 under Relax without the internal compiler error.

Written by the indexing model from the issue text.

Description

On 30917dca5 (macOS arm64, rustc 1.100.0), spawning one task on tokio's multi-thread runtime panics under Relax with an internal compiler error while resolving tokio::util::sharded_list::ShardedListItem::get_shard_id. rustc runs the program.

Cargo.toml

[package]
name = "repro-tokio"
version = "0.1.0"
edition = "2024"

[workspace]

[dependencies]
tokio = { version = "=1.54.1", features = ["rt-multi-thread"] }

src/main.rs

fn main() {
    let runtime = tokio::runtime::Builder::new_multi_thread().build().unwrap();
    let answer = runtime.block_on(async { tokio::spawn(async { 42 }).await.unwrap() });
    println!("{answer}");
}

Expected (cargo run): prints 42.

Actual (relax run --unattended repro-tokio, exit 101):

relax: main panic: compile error in tokio::util::sharded_list::ShardedList::lock_shard<Task<Arc<Handle>>>: internal compiler error in tokio::util::sharded_list::ShardedList::lock_shard: failed to resolve instance for tokio::util::sharded_list::ShardedListItem::get_shard_id with [Task<Arc<Handle>>]: Unimplemented (at libs/relax/types/src/instance.rs:238)

The failing call is tokio 1.54.1 src/util/sharded_list.rs:91, L::get_shard_id(L::as_raw(val)), where ShardedListItem: Link declares unsafe fn get_shard_id(target: NonNull<Self::Target>) -> usize and the impl is unsafe impl<S> ShardedListItem for Task<S> (src/runtime/task/mod.rs:627). A std-only copy of just that trait shape (supertrait associated type in an unsafe associated fn, called through a generic) runs correctly under Relax, so the trigger is something else in tokio's real types; I could not reduce it further without tokio.

Dominant language
Rust
Stars
601
Forks
34
Avg merge
1h 58m
Merged PRs (30d)
45

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from makepad/relax

All issues in makepad/relax

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.