shellrow / netdev

Cross-platform library for network interface and gateway. Written in Rust.
MIT License
65 stars 12 forks source link

Panic on macOS #42

Closed dignifiedquire closed 11 months ago

dignifiedquire commented 1 year ago

Encountered this recently, unclear what exactly is going wrong, but sth doesn't seem to always work out.

thread 'main-runtime' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `5`', /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/default-net-0.16.2/src/gateway/macos.rs:293:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:229:5
   4: default_net::gateway::macos::list_routes
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/default-net-0.16.2/src/gateway/macos.rs:293:9
   5: default_net::gateway::macos::get_default_route
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/default-net-0.16.2/src/gateway/macos.rs:412:11
   6: default_net::gateway::macos::get_default_gateway
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/default-net-0.16.2/src/gateway/macos.rs:431:26
   7: default_net::interface::unix::interfaces
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/default-net-0.16.2/src/interface/unix.rs:63:27
   8: iroh_net::net::interfaces::State::new::{{closure}}
             at ./iroh-net/src/net/interfaces.rs:194:22
   9: iroh_net::netcheck::reportgen::Actor::prepare_probes_task::{{closure}}
             at ./iroh-net/src/netcheck/reportgen.rs:570:49
  10: iroh_net::netcheck::reportgen::Actor::run_inner::{{closure}}
             at ./iroh-net/src/netcheck/reportgen.rs:236:53
  11: iroh_net::netcheck::reportgen::Actor::run::{{closure}}
             at ./iroh-net/src/netcheck/reportgen.rs:201:32
  12: iroh_net::netcheck::reportgen::Client::new::{{closure}}
             at ./iroh-net/src/netcheck/reportgen.rs:116:38
  13: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.37/src/instrument.rs:272:9
  14: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:334:17
  15: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/loom/std/unsafe_cell.rs:16:9
  16: tokio::runtime::task::core::Core<T,S>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:323:13
  17: tokio::runtime::task::harness::poll_future::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:485:19
  18: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panic/unwind_safe.rs:271:9
  19: std::panicking::try::do_call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
  20: std::panicking::try
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
  21: std::panic::catch_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
  22: tokio::runtime::task::harness::poll_future
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:473:18
  23: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:208:27
  24: tokio::runtime::task::harness::Harness<T,S>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:153:15
  25: tokio::runtime::task::raw::RawTask::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/raw.rs:200:18
  26: tokio::runtime::task::LocalNotified<S>::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/mod.rs:400:9
  27: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:639:22
  28: tokio::runtime::coop::with_budget
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:107:5
  29: tokio::runtime::coop::budget
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:73:5
  30: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:575:9
  31: tokio::runtime::scheduler::multi_thread::worker::Context::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:526:24
  32: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:491:21
  33: tokio::runtime::context::scoped::Scoped<T>::set
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/scoped.rs:40:9
  34: tokio::runtime::context::set_scheduler::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context.rs:176:26
  35: std::thread::local::LocalKey<T>::try_with
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/thread/local.rs:270:16
  36: std::thread::local::LocalKey<T>::with
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/thread/local.rs:246:9
  37: tokio::runtime::context::set_scheduler
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context.rs:176:17
  38: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:486:9
  39: tokio::runtime::context::runtime::enter_runtime
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/runtime.rs:65:16
  40: tokio::runtime::scheduler::multi_thread::worker::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:478:5
  41: tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:447:45
  42: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/task.rs:42:21
  43: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:334:17
  44: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/loom/std/unsafe_cell.rs:16:9
  45: tokio::runtime::task::core::Core<T,S>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:323:13
  46: tokio::runtime::task::harness::poll_future::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:485:19
  47: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panic/unwind_safe.rs:271:9
  48: std::panicking::try::do_call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
  49: std::panicking::try
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
  50: std::panic::catch_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
  51: tokio::runtime::task::harness::poll_future
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:473:18
  52: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:208:27
  53: tokio::runtime::task::harness::Harness<T,S>::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:153:15
  54: tokio::runtime::task::raw::RawTask::poll
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/raw.rs:200:18
  55: tokio::runtime::task::UnownedTask<S>::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/mod.rs:437:9
  56: tokio::runtime::blocking::pool::Task::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:159:9
  57: tokio::runtime::blocking::pool::Inner::run
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:513:17
  58: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
             at /Users/b5/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:471:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

First reported in https://github.com/n0-computer/iroh/issues/1442

shellrow commented 11 months ago

I could not find the root cause as well. Anyway, thanks for the report and pull request.

dignifiedquire commented 10 months ago

Managed to get at least a report, this was in a long running process, and the mac was asleep, and when I woke it up I saw these messages.

unexpected RTM_VERSION: 0 in rt_msghdr { rtm_msglen: 0, rtm_version: 0, rtm_type: 0, rtm_index: 0, rtm_flags: 0, rtm_addrs: 0, rtm_pid: 0, rtm_seq: 0, rtm_errno: 0, rtm_use: 0, rtm_inits: 0, rtm_rmx: rt_metrics { rmx_locks: 0, rmx_mtu: 0, rmx_hopcount: 0, rmx_expire: 0, rmx_recvpipe: 0, rmx_sendpipe: 0, rmx_ssthresh: 0, rmx_rtt: 0, rmx_rttvar: 0, rmx_pksent: 0, rmx_state: 0, rmx_filler: [0, 0, 0] } }
unexpected RTM_VERSION: 0 in rt_msghdr { rtm_msglen: 0, rtm_version: 0, rtm_type: 0, rtm_index: 0, rtm_flags: 0, rtm_addrs: 0, rtm_pid: 0, rtm_seq: 0, rtm_errno: 0, rtm_use: 0, rtm_inits: 0, rtm_rmx: rt_metrics { rmx_locks: 0, rmx_mtu: 0, rmx_hopcount: 0, rmx_expire: 0, rmx_recvpipe: 0, rmx_sendpipe: 0, rmx_ssthresh: 0, rmx_rtt: 0, rmx_rttvar: 0, rmx_pksent: 0, rmx_state: 0, rmx_filler: [0, 0, 0] } }