tursodatabase/libsql

No reactor running error with Python bindings

penberg opened this issue · 1 comments

The libsql crate has a regression, which breaks the Python bindings as follows:

there is no reactor running, must be called from the context of a Tokio 1.x runtime
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
pyo3_runtime.PanicException: there is no reactor running, must be called from the context of a Tokio 1.x runtime
(.env) penberg@vonneumann libsql-experimental-python % RUST_BACKTRACE=1 python3 /Users/penberg/tmp/libsql-python/test.py
thread '<unnamed>' panicked at /Users/penberg/.cargo/git/checkouts/libsql-311658d335deb3b1/9de3ccc/libsql/src/hrana/hyper.rs:88:9:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:178:5
   3: tokio::task::spawn::spawn_inner::panic_cold_display
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panic.rs:99:13
   4: tokio::task::spawn::spawn_inner
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/task/spawn.rs:203:23
   5: tokio::task::spawn::spawn
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/task/spawn.rs:174:13
   6: <libsql::hrana::hyper::HttpSender as libsql::hrana::HttpSend>::oneshot
             at /Users/penberg/.cargo/git/checkouts/libsql-311658d335deb3b1/9de3ccc/libsql/src/hrana/hyper.rs:88:9
   7: <libsql::hrana::stream::RawStream<T> as core::ops::drop::Drop>::drop
             at /Users/penberg/.cargo/git/checkouts/libsql-311658d335deb3b1/9de3ccc/libsql/src/hrana/stream.rs:441:13
   8: core::ptr::drop_in_place<libsql::hrana::stream::RawStream<libsql::hrana::hyper::HttpSender>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
   9: core::ptr::drop_in_place<core::cell::UnsafeCell<libsql::hrana::stream::RawStream<libsql::hrana::hyper::HttpSender>>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  10: core::ptr::drop_in_place<tokio::sync::mutex::Mutex<libsql::hrana::stream::RawStream<libsql::hrana::hyper::HttpSender>>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  11: core::ptr::drop_in_place<libsql::hrana::stream::Inner<libsql::hrana::hyper::HttpSender>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  12: alloc::sync::Arc<T,A>::drop_slow
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:1752:18
  13: <alloc::sync::Arc<T,A> as core::ops::drop::Drop>::drop
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:2408:13
  14: core::ptr::drop_in_place<alloc::sync::Arc<libsql::hrana::stream::Inner<libsql::hrana::hyper::HttpSender>>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  15: core::ptr::drop_in_place<libsql::hrana::stream::HranaStream<libsql::hrana::hyper::HttpSender>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  16: core::ptr::drop_in_place<libsql::hrana::connection::InnerClient<libsql::hrana::hyper::HttpSender>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  17: alloc::sync::Arc<T,A>::drop_slow
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:1752:18
  18: <alloc::sync::Arc<T,A> as core::ops::drop::Drop>::drop
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:2408:13
  19: core::ptr::drop_in_place<alloc::sync::Arc<libsql::hrana::connection::InnerClient<libsql::hrana::hyper::HttpSender>>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  20: core::ptr::drop_in_place<libsql::hrana::connection::HttpConnection<libsql::hrana::hyper::HttpSender>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  21: core::ptr::drop_in_place<dyn libsql::connection::Conn+core::marker::Send+core::marker::Sync>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  22: alloc::sync::Arc<T,A>::drop_slow
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:1752:18
  23: <alloc::sync::Arc<T,A> as core::ops::drop::Drop>::drop
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:2408:13
  24: core::ptr::drop_in_place<alloc::sync::Arc<dyn libsql::connection::Conn+core::marker::Send+core::marker::Sync>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  25: core::ptr::drop_in_place<libsql::connection::Connection>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  26: alloc::sync::Arc<T,A>::drop_slow
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:1752:18
  27: <alloc::sync::Arc<T,A> as core::ops::drop::Drop>::drop
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/sync.rs:2408:13
  28: core::ptr::drop_in_place<alloc::sync::Arc<libsql::connection::Connection>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  29: core::ptr::drop_in_place<libsql_experimental::Connection>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  30: core::ptr::drop_in_place<core::cell::UnsafeCell<libsql_experimental::Connection>>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  31: core::mem::manually_drop::ManuallyDrop<T>::drop
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/mem/manually_drop.rs:144:18
  32: <pyo3::pycell::PyCell<T> as pyo3::pycell::PyCellLayout<T>>::tp_dealloc
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/pycell.rs:941:13
  33: pyo3::impl_::trampoline::dealloc::{{closure}}
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/impl_/trampoline.rs:148:13
  34: pyo3::impl_::trampoline::trampoline_unraisable::{{closure}}
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/impl_/trampoline.rs:224:54
  35: std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  36: ___rust_try
  37: std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  38: std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  39: pyo3::impl_::trampoline::trampoline_unraisable
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/impl_/trampoline.rs:224:26
  40: pyo3::impl_::trampoline::dealloc
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/impl_/trampoline.rs:146:5
  41: pyo3::impl_::pyclass::tp_dealloc
             at /Users/penberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.19.2/src/impl_/pyclass.rs:997:5
  42: _dictkeys_decref
  43: _dict_dealloc
  44: _module_dealloc
  45: _insertdict
  46: _finalize_modules
  47: _Py_FinalizeEx
  48: _Py_RunMain
  49: _Py_BytesMain
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
pyo3_runtime.PanicException: there is no reactor running, must be called from the context of a Tokio 1.x runtime

@LucioFranco ended up fixing this in the Python bindings: tursodatabase/libsql-experimental-python#37