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

Pkarr panics with infallible #131

Closed
SeverinAlexB opened this issue Feb 24, 2025 · 2 comments · Fixed by #132
Closed

Pkarr panics with infallible #131

SeverinAlexB opened this issue Feb 24, 2025 · 2 comments · Fixed by #132

Comments

@SeverinAlexB
Copy link
Contributor

I am currently updating pkdns to pkarr v3.5.0.

One of my tests fails occasionally with

thread 'resolution::pkd::pkarr_resolver::tests::query_pubkey' panicked at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client/relays.rs:109:14:
infallible
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
   2: core::panicking::panic_display
             at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:269:5
   3: core::option::expect_failed
             at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2018:5
   4: core::option::Option<T>::expect
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:933:21
   5: pkarr::client::relays::RelaysClient::publish::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client/relays.rs:101:9
   6: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.6.0/src/future.rs:457:33
   7: pkarr::client::Client::select_publish_future::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client.rs:341:14
   8: pkarr::client::Client::publish_inner::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client.rs:304:56
   9: pkarr::client::async_compat_if_necessary::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client.rs:677:9
  10: pkarr::client::Client::publish::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkarr-3.5.0/src/client.rs:230:75
  11: pkdns::resolution::pkd::pkarr_resolver::tests::publish_record::{{closure}}
             at ./src/resolution/pkd/pkarr_resolver.rs:364:59
  12: pkdns::resolution::pkd::pkarr_resolver::tests::query_pubkey::{{closure}}
             at ./src/resolution/pkd/pkarr_resolver.rs:399:26
  13: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
  14: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
  15: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:729:57
  16: tokio::runtime::coop::with_budget
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/coop.rs:107:5
  17: tokio::runtime::coop::budget
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/coop.rs:73:5
  18: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:729:25
  19: tokio::runtime::scheduler::current_thread::Context::enter
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:428:19
  20: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:728:36
  21: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:807:68
  22: tokio::runtime::context::scoped::Scoped<T>::set
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/context/scoped.rs:40:9
  23: tokio::runtime::context::set_scheduler::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/context.rs:180:26
  24: std::thread::local::LocalKey<T>::try_with
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12
  25: std::thread::local::LocalKey<T>::with
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9
  26: tokio::runtime::context::set_scheduler
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/context.rs:180:9
  27: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:807:27
  28: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:716:19
  29: tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:196:28
  30: tokio::runtime::context::runtime::enter_runtime
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/context/runtime.rs:65:16
  31: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/scheduler/current_thread/mod.rs:184:9
  32: tokio::runtime::runtime::Runtime::block_on_inner
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/runtime.rs:368:47
  33: tokio::runtime::runtime::Runtime::block_on
             at /Users/severinbuhler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.43.0/src/runtime/runtime.rs:342:13
  34: pkdns::resolution::pkd::pkarr_resolver::tests::query_pubkey
             at ./src/resolution/pkd/pkarr_resolver.rs:422:9
  35: pkdns::resolution::pkd::pkarr_resolver::tests::query_pubkey::{{closure}}
             at ./src/resolution/pkd/pkarr_resolver.rs:398:28
  36: core::ops::function::FnOnce::call_once
             at /Users/severinbuhler/.rustup/toolchains/1.84.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  37: core::ops::function::FnOnce::call_once
             at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

There seems to be an unhandled .expect("infallible") that needs attention.

How to reproduce: Running this test alone is no problem. Only when I run the whole test suite cargo test in my PR the problem shows up.

@Nuhvi
Copy link
Collaborator

Nuhvi commented Feb 24, 2025

I can look into it and try to replicate it with an MRE, but in the meantime, the obvious solution for you is to:

  1. Not use relays in your test client.
  2. Better yet, don't run tests with main net client

I see you are using a main net client with both networks (default) here.

You might find it helpful to see how Pkarr crate do tests like these https://github.com/pubky/pkarr/blob/main/pkarr/src/client/tests.rs#L22

@SeverinAlexB
Copy link
Contributor Author

Removing relays worked thx

Nuhvi added a commit to Nuhvi/pkarr that referenced this issue Feb 25, 2025
closes pubky#131

InflightPublishRequests::done() had a bug caclulating the number of errors
Nuhvi added a commit to Nuhvi/pkarr that referenced this issue Feb 25, 2025
closes pubky#131

InflightPublishRequests::done() had a bug caclulating the number of errors
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 a pull request may close this issue.

2 participants