leptos-rs / leptos

Build fast web applications with Rust.
https://leptos.dev
MIT License
15.87k stars 624 forks source link

[0.7] Dropped SendWrapper panic #2907

Open osmano807 opened 2 weeks ago

osmano807 commented 2 weeks ago

Describe the bug The application panics with the error message: "Dropped SendWrapper variable from a thread different to the one it has been created with." When accessing the following code I get a panic in the server. The reproduction is finicky, managed to generate a minimal reproduction copying my project structure. Some changes stops reproducing the panic, like removing the nested <Suspense>.

Leptos Dependencies

leptos = { version = "0.7.0-beta", features = ["nightly"] }
leptos_axum = { version = "0.7.0-beta", optional = true }
leptos_meta = { version = "0.7.0-beta" }
leptos_router = { version = "0.7.0-beta", features = ["nightly"] }

To Reproduce Steps to reproduce the behavior:

  1. Use the start-axum-0.7 template
  2. Switch the app.rs to use the following components:
    
    use leptos::prelude::*;
    use leptos_meta::{provide_meta_context, MetaTags};
    use leptos_router::{components::*, hooks::use_params, params::Params, path, MatchNestedRoutes};

//use leptos::logging::*;

pub fn shell(options: LeptosOptions) -> impl IntoView { view! { <!DOCTYPE html>

}

}

[component]

pub fn App() -> impl IntoView { provide_meta_context();

view! {
    <Router>
        <Routes fallback=|| {
            view! {}
        }>
            <Route path=path!("") view=Hello />
            <ItemCollectionRoutes />
        </Routes>
    </Router>
}

}

[component]

fn Hello() -> impl IntoView { view! {

Hello

} }

[component]

pub fn ListItems() -> impl IntoView { view! {

    <ItemTable />
}

}

[component]

fn Header() -> impl IntoView { let user_id = query_user_id();

view! { <Suspense>{move || {}}</Suspense> }

}

[component]

fn ItemTable() -> impl IntoView { let user_id = query_user_id();

view! { <Suspense>{move || {}}</Suspense> }

}

pub fn query_user_id() -> Memo<Result<String, String>> { let params = use_params::();

Memo::new(move |_| params.get().map(|p| p.user_id).map_err(|e| e.to_string()))

}

[derive(Params, PartialEq, Clone)]

struct UserParams { user_id: String, }

[component]

fn ItemCollectionRoutes() -> impl MatchNestedRoutes + Clone { view! { <ParentRoute path=path!("") view=DrawerItemCollection> <Route path=path!("/a/:user_id/b") view=ListItems /> } .into_inner() }

[component]

pub fn DrawerItemCollection() -> impl IntoView { view! { } }

[component]

fn SidebarItemCollection() -> impl IntoView { let user_id = query_user_id();

view! {
    <Suspense>
        <Suspense>
            <A href="/new" attr:class="link link-primary">
                New Item
            </A>
        </Suspense>
    </Suspense>
}

}

[component]

fn DrawerGeneric(sidebar: impl IntoView) -> impl IntoView { view! {

    <div>{sidebar}</div>
}

}

3. Run the application and navigate to the route "/a/{some_id}/b" with multiple concurrent clients:
```sh
❯ bombardier 'http://localhost:8000/a/4tby3jdw/b'
Bombarding http://localhost:8000/a/4tby3jdw/b for 10s using 125 connection(s)
[=====================================================================] 10s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec      2309.86     713.81    9768.23
  Latency       54.53ms    11.72ms   181.33ms
  HTTP codes:
    1xx - 0, 2xx - 22986, 3xx - 0, 4xx - 0, 5xx - 0
    others - 1
  Errors:
    the server closed connection before returning the first response byte. Make sure the server returns 'Connection: close' response header before closing the connection - 1
  Throughput:    10.82MB/s
  1. Observe the application crash with the mentioned error.

Expected behavior The application should render the components for the given route without crashing.

Error Message

thread 'tokio-runtime-worker' panicked at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1:
Dropped SendWrapper<T> variable from a thread different to the one it has been created with.
**Error Log with Backtrace** ``` thread 'tokio-runtime-worker' panicked at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1: Dropped SendWrapper variable from a thread different to the one it has been created with. stack backtrace: 0: rust_begin_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:662:5 1: core::panicking::panic_fmt at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panicking.rs:74:14 2: core::panicking::panic_display at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panicking.rs:264:5 3: send_wrapper::invalid_drop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/send_wrapper-0.6.0/src/lib.rs:291:3 4: as core::ops::drop::Drop>::drop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/send_wrapper-0.6.0/src/lib.rs:230:4 5: core::ptr::drop_in_place>> at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1 6: core::ptr::drop_in_place>>> at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1 7: as tachys::html::attribute::Attribute>::dry_resolve at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/html/property.rs:121:26 8: <(A,B,C,D,E,F) as tachys::html::attribute::Attribute>::dry_resolve at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/html/attribute/mod.rs:332:19 9: as tachys::view::RenderHtml>::dry_resolve at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/html/element/mod.rs:253:9 10: as tachys::view::RenderHtml>::dry_resolve at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-0.7.0-beta4/src/into_view.rs:93:9 11: as tachys::view::RenderHtml>::dry_resolve at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-0.7.0-beta4/src/into_view.rs:93:9 12: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-0.7.0-beta4/src/suspense_component.rs:299:9 13: as tachys::view::RenderHtml>::to_html_async_with_buf::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/reactive_graph/owned.rs:144:13 14: reactive_graph::owner::Owner::with at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reactive_graph-0.1.0-beta4/src/owner.rs:190:19 15: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/reactive_graph/owned.rs:143:9 16: as tachys::view::RenderHtml>::to_html_async_with_buf::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/reactive_graph/owned.rs:144:13 17: reactive_graph::owner::Owner::with at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reactive_graph-0.1.0-beta4/src/owner.rs:190:19 18: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/reactive_graph/owned.rs:143:9 19: tachys::ssr::StreamBuilder::push_async_out_of_order::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/ssr/mod.rs:191:21 20: ::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/ssr/mod.rs:327:31 21: ::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tachys-0.1.0-beta4/src/ssr/mod.rs:383:33 22: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:50:40 23: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:120:9 24: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/fuse.rs:53:27 25: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/ready_chunks.rs:40:19 26: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/map.rs:58:26 27: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:56:9 28: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:120:9 29: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:56:9 30: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:50:40 31: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reactive_graph-0.1.0-beta4/src/owner/arena.rs:170:23 32: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/map.rs:58:26 33: ::try_poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:196:9 34: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.4.3/src/body.rs:205:36 35: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-body-util-0.1.2/src/combinators/map_err.rs:62:15 36: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-body-util-0.1.2/src/combinators/box_body.rs:103:9 37: ::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.4.3/src/body.rs:122:9 38: hyper::proto::h1::dispatch::Dispatcher::poll_write at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:373:39 39: hyper::proto::h1::dispatch::Dispatcher::poll_loop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:173:21 40: hyper::proto::h1::dispatch::Dispatcher::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:149:16 41: hyper::proto::h1::dispatch::Dispatcher::poll_catch at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:128:28 42: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:471:9 43: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/server/conn/http1.rs:511:26 44: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.7/src/server/conn/auto.rs:593:28 45: as core::future::into_future::IntoFuture>::into_future::{{closure}}::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.5/src/serve.rs:218:26 46: tokio::runtime::task::core::Core::poll::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:331:17 47: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/loom/std/unsafe_cell.rs:16:9 48: tokio::runtime::task::core::Core::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:320:13 49: tokio::runtime::task::harness::poll_future::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:500:19 50: as core::ops::function::FnOnce<()>>::call_once at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panic/unwind_safe.rs:272:9 51: std::panicking::try::do_call at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:554:40 52: __rust_try 53: std::panicking::try at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:518:19 54: std::panic::catch_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panic.rs:345:14 55: tokio::runtime::task::harness::poll_future at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:488:18 56: tokio::runtime::task::harness::Harness::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:209:27 57: tokio::runtime::task::harness::Harness::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:154:15 58: tokio::runtime::task::raw::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:271:5 59: tokio::runtime::task::raw::RawTask::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:201:18 60: tokio::runtime::task::LocalNotified::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/mod.rs:436:9 61: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:661:17 62: tokio::runtime::coop::with_budget at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:107:5 63: tokio::runtime::coop::budget at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:73:5 64: tokio::runtime::scheduler::multi_thread::worker::Context::run_task at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:597:9 65: tokio::runtime::scheduler::multi_thread::worker::Context::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:560:24 66: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:513:21 67: tokio::runtime::context::scoped::Scoped::set at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/scoped.rs:40:9 68: tokio::runtime::context::set_scheduler::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:26 69: std::thread::local::LocalKey::try_with at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/thread/local.rs:283:12 70: std::thread::local::LocalKey::with at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/thread/local.rs:260:9 71: tokio::runtime::context::set_scheduler at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:9 72: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:508:9 73: tokio::runtime::context::runtime::enter_runtime at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/runtime.rs:65:16 74: tokio::runtime::scheduler::multi_thread::worker::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:500:5 75: tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:466:45 76: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/task.rs:42:21 77: tokio::runtime::task::core::Core::poll::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:331:17 78: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/loom/std/unsafe_cell.rs:16:9 79: tokio::runtime::task::core::Core::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:320:13 80: tokio::runtime::task::harness::poll_future::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:500:19 81: as core::ops::function::FnOnce<()>>::call_once at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panic/unwind_safe.rs:272:9 82: std::panicking::try::do_call at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:554:40 83: __rust_try 84: std::panicking::try at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:518:19 85: std::panic::catch_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panic.rs:345:14 86: tokio::runtime::task::harness::poll_future at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:488:18 87: tokio::runtime::task::harness::Harness::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:209:27 88: tokio::runtime::task::harness::Harness::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:154:15 89: tokio::runtime::task::raw::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:271:5 90: tokio::runtime::task::raw::RawTask::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:201:18 91: tokio::runtime::task::UnownedTask::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/mod.rs:473:9 92: tokio::runtime::blocking::pool::Task::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:160:9 93: tokio::runtime::blocking::pool::Inner::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:518:17 94: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:476:13 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```
gbj commented 1 week ago

Thanks, the repro is great here! Could you do me a favor and test #2911 against your non-minimal example? I think it should fix the issue but not entirely sure.

osmano807 commented 1 week ago

Don't think so, tested in my project and with the reproduction, still panics.

Leptos Dependencies

leptos = { git = "https://github.com/leptos-rs/leptos.git", features = [
  "nightly",
], rev = "refs/pull/2911/head" }
leptos_meta = { git = "https://github.com/leptos-rs/leptos.git", rev = "refs/pull/2911/head" }
leptos_router = { git = "https://github.com/leptos-rs/leptos.git", features = [
  "nightly",
], rev = "refs/pull/2911/head" }
leptos_axum = { git = "https://github.com/leptos-rs/leptos.git", rev = "refs/pull/2911/head" }

Panic

thread 'tokio-runtime-worker' panicked at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1:
Dropped SendWrapper<T> variable from a thread different to the one it has been created with.
Backtrace ``` stack backtrace: 0: rust_begin_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:662:5 1: core::panicking::panic_fmt at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panicking.rs:74:14 2: core::panicking::panic_display at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panicking.rs:264:5 3: send_wrapper::invalid_drop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/send_wrapper-0.6.0/src/lib.rs:291:3 4: as core::ops::drop::Drop>::drop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/send_wrapper-0.6.0/src/lib.rs:230:4 5: core::ptr::drop_in_place>> at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1 6: core::ptr::drop_in_place>>> at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/ptr/mod.rs:574:1 7: as tachys::html::attribute::Attribute>::dry_resolve at /home/opc/Documents/leptos/tachys/src/html/property.rs:121:26 8: <(A,B,C,D,E,F) as tachys::html::attribute::Attribute>::dry_resolve at /home/opc/Documents/leptos/tachys/src/html/attribute/mod.rs:332:19 9: as tachys::view::RenderHtml>::dry_resolve at /home/opc/Documents/leptos/tachys/src/html/element/mod.rs:253:9 10: as tachys::view::RenderHtml>::dry_resolve at /home/opc/Documents/leptos/leptos/src/into_view.rs:93:9 11: as tachys::view::RenderHtml>::dry_resolve at /home/opc/Documents/leptos/leptos/src/into_view.rs:93:9 12: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/Documents/leptos/leptos/src/suspense_component.rs:286:9 13: as tachys::view::RenderHtml>::to_html_async_with_buf::{{closure}} at /home/opc/Documents/leptos/tachys/src/reactive_graph/owned.rs:144:13 14: reactive_graph::owner::Owner::with at /home/opc/Documents/leptos/reactive_graph/src/owner.rs:190:19 15: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/Documents/leptos/tachys/src/reactive_graph/owned.rs:143:9 16: as tachys::view::RenderHtml>::to_html_async_with_buf::{{closure}} at /home/opc/Documents/leptos/tachys/src/reactive_graph/owned.rs:144:13 17: reactive_graph::owner::Owner::with at /home/opc/Documents/leptos/reactive_graph/src/owner.rs:190:19 18: as tachys::view::RenderHtml>::to_html_async_with_buf at /home/opc/Documents/leptos/tachys/src/reactive_graph/owned.rs:143:9 19: tachys::ssr::StreamBuilder::push_async_out_of_order::{{closure}} at /home/opc/Documents/leptos/tachys/src/ssr/mod.rs:191:21 20: ::poll_next at /home/opc/Documents/leptos/tachys/src/ssr/mod.rs:327:31 21: ::poll_next at /home/opc/Documents/leptos/tachys/src/ssr/mod.rs:383:33 22: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:50:40 23: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:120:9 24: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/fuse.rs:53:27 25: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/ready_chunks.rs:40:19 26: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/map.rs:58:26 27: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:56:9 28: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:120:9 29: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:56:9 30: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/chain.rs:50:40 31: as futures_core::stream::Stream>::poll_next at /home/opc/Documents/leptos/reactive_graph/src/owner/arena.rs:170:23 32: as futures_core::stream::Stream>::poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/stream/stream/map.rs:58:26 33: ::try_poll_next at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/stream.rs:196:9 34: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.4.3/src/body.rs:205:36 35: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-body-util-0.1.2/src/combinators/map_err.rs:62:15 36: as http_body::Body>::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-body-util-0.1.2/src/combinators/box_body.rs:103:9 37: ::poll_frame at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.4.3/src/body.rs:122:9 38: hyper::proto::h1::dispatch::Dispatcher::poll_write at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:373:39 39: hyper::proto::h1::dispatch::Dispatcher::poll_loop at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:173:21 40: hyper::proto::h1::dispatch::Dispatcher::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:149:16 41: hyper::proto::h1::dispatch::Dispatcher::poll_catch at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:128:28 42: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/proto/h1/dispatch.rs:471:9 43: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.4.1/src/server/conn/http1.rs:511:26 44: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.7/src/server/conn/auto.rs:593:28 45: as core::future::into_future::IntoFuture>::into_future::{{closure}}::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.5/src/serve.rs:218:26 46: tokio::runtime::task::core::Core::poll::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:331:17 47: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/loom/std/unsafe_cell.rs:16:9 48: tokio::runtime::task::core::Core::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:320:13 49: tokio::runtime::task::harness::poll_future::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:500:19 50: as core::ops::function::FnOnce<()>>::call_once at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panic/unwind_safe.rs:272:9 51: std::panicking::try::do_call at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:554:40 52: __rust_try 53: std::panicking::try at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:518:19 54: std::panic::catch_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panic.rs:345:14 55: tokio::runtime::task::harness::poll_future at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:488:18 56: tokio::runtime::task::harness::Harness::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:209:27 57: tokio::runtime::task::harness::Harness::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:154:15 58: tokio::runtime::task::raw::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:271:5 59: tokio::runtime::task::raw::RawTask::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:201:18 60: tokio::runtime::task::LocalNotified::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/mod.rs:436:9 61: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:661:17 62: tokio::runtime::coop::with_budget at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:107:5 63: tokio::runtime::coop::budget at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:73:5 64: tokio::runtime::scheduler::multi_thread::worker::Context::run_task at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:597:9 65: tokio::runtime::scheduler::multi_thread::worker::Context::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:560:24 66: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:513:21 67: tokio::runtime::context::scoped::Scoped::set at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/scoped.rs:40:9 68: tokio::runtime::context::set_scheduler::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:26 69: std::thread::local::LocalKey::try_with at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/thread/local.rs:283:12 70: std::thread::local::LocalKey::with at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/thread/local.rs:260:9 71: tokio::runtime::context::set_scheduler at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context.rs:180:9 72: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:508:9 73: tokio::runtime::context::runtime::enter_runtime at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/runtime.rs:65:16 74: tokio::runtime::scheduler::multi_thread::worker::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:500:5 75: tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/worker.rs:466:45 76: as core::future::future::Future>::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/task.rs:42:21 77: tokio::runtime::task::core::Core::poll::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:331:17 78: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/loom/std/unsafe_cell.rs:16:9 79: tokio::runtime::task::core::Core::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/core.rs:320:13 80: tokio::runtime::task::harness::poll_future::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:500:19 81: as core::ops::function::FnOnce<()>>::call_once at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/core/src/panic/unwind_safe.rs:272:9 82: std::panicking::try::do_call at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:554:40 83: __rust_try 84: std::panicking::try at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panicking.rs:518:19 85: std::panic::catch_unwind at /rustc/0d634185dfddefe09047881175f35c65d68dcff1/library/std/src/panic.rs:345:14 86: tokio::runtime::task::harness::poll_future at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:488:18 87: tokio::runtime::task::harness::Harness::poll_inner at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:209:27 88: tokio::runtime::task::harness::Harness::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/harness.rs:154:15 89: tokio::runtime::task::raw::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:271:5 90: tokio::runtime::task::raw::RawTask::poll at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/raw.rs:201:18 91: tokio::runtime::task::UnownedTask::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/task/mod.rs:473:9 92: tokio::runtime::blocking::pool::Task::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:160:9 93: tokio::runtime::blocking::pool::Inner::run at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:518:17 94: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}} at /home/opc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/blocking/pool.rs:476:13 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```
gbj commented 1 week ago

Thanks, turns out I was testing it incorrectly.

Here's a simpler reproduction:

#[component]
pub fn App() -> impl IntoView {
    view! {
        <Router>
            <Routes fallback=|| ()>
                <ParentRoute path=path!("") view=Parent>
                    <Route path=path!("") view=Child/>
                </ParentRoute>
            </Routes>
        </Router>
    }
}

#[component]
fn Parent() -> impl IntoView {
    view! {
        <Outlet/>
        <Suspense>
            <Suspense>
                <A href="/new" attr:class="link link-primary">
                    New Item
                </A>
            </Suspense>
        </Suspense>
    }
}

#[component]
pub fn Child() -> impl IntoView {
    view! { <Suspense>{move || {}}</Suspense> }
}

The panic is caused by the prop:state on <A/>.

Each of three conditions is required for it not to remove the SendWrapper around the prop correctly:

  • Suspense in Child
  • nested Suspense in Parent
  • Outlet in parent

If any of those three is removed, it does not panic. If <A/> is not used or <A/> is modified so that it does not use prop:state, of course it does not panic.

I'll have to look at it more to figure out what the underlying issue is, though.

gbj commented 1 week ago

This should incidentally be fixed by #2912, which I think is a good idea in any case but which doesn't address the actual problem here.