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

test: add tests to reproduce panic on task spawn while drop #229

Closed
wants to merge 3 commits into from

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented Oct 7, 2024

Reproduce #228.

We instantiate a struct outside the thread, and then move it into a future. Subsequently we spawn the future in a thread, dropping the struct.

Then the panic is reproduced.

out.log

connection: broken pipe", details: [], metadata: MetadataMap { headers: {} }
thread '<unnamed>' panicked at /risingwave/.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-0.2.30/src/sim/runtime/context.rs:27:44:
there is no reactor running, must be called from the context of a Madsim runtime
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/core/src/panicking.rs:74:14
   2: core::panicking::panic_display
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/core/src/panicking.rs:264:5
   3: core::option::expect_failed
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/core/src/option.rs:2030:5
   4: expect<alloc::sync::Arc<madsim::sim::task::TaskInfo, alloc::alloc::Global>>
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/core/src/option.rs:933:21
   5: {closure#0}
             at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-0.2.30/src/sim/runtime/context.rs:27:44
   6: try_with<core::cell::RefCell<core::option::Option<alloc::sync::Arc<madsim::sim::task::TaskInfo, alloc::alloc::Global>>>, madsim::sim::runtime::context::current_task::{closure_env#0}, alloc::sync::Arc<madsim::sim::task::TaskInfo, alloc::alloc::Global>>
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/std/src/thread/local.rs:283:12
   7: with<core::cell::RefCell<core::option::Option<alloc::sync::Arc<madsim::sim::task::TaskInfo, alloc::alloc::Global>>>, madsim::sim::runtime::context::current_task::{closure_env#0}, alloc::sync::Arc<madsim::sim::task::TaskInfo, alloc::alloc::Global>>
             at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library/std/src/thread/local.rs:260:9
   8: current_task
             at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-0.2.30/src/sim/runtime/context.rs:27:10
   9: current
             at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-0.2.30/src/sim/task/mod.rs:586:20
  10: spawn<sqlx_core::pool::connection::{impl#5}::return_to_pool::{async_block_env#1}<sqlx_sqlite::database::Sqlite>>
             at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-0.2.30/src/sim/task/mod.rs:664:5
  11: spawn<sqlx_core::pool::connection::{impl#5}::return_to_pool::{async_block_env#1}<sqlx_sqlite::database::Sqlite>>
             at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/madsim-tokio-0.2.30/src/sim/runtime.rs:152:9
  12: spawn<sqlx_core::pool::connection::{impl#5}::return_to_pool::{async_block_env#1}<sqlx_sqlite::database::Sqlite>>

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.

1 participant