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

Panics on [tcpin, tcpout, udpout, udpin, udpbcast]: failed to lookup address information: Temporary failure in name resolution #218

Closed
joaoantoniocardoso opened this issue Jan 10, 2024 · 0 comments · Fixed by #219

Comments

@joaoantoniocardoso
Copy link
Contributor

For example, tcpout:

pub fn tcpout<T: ToSocketAddrs>(address: T) -> io::Result<TcpConnection> {
    let addr = address
        .to_socket_addrs()
        .unwrap()
        .next()
        .expect("Host address lookup failed.");
    let socket = TcpStream::connect(addr)?;
    socket.set_read_timeout(Some(Duration::from_millis(100)))?;

    Ok(TcpConnection {
        reader: Mutex::new(socket.try_clone()?),
        writer: Mutex::new(TcpWrite {
            socket,
            sequence: 0,
        }),
        protocol_version: MavlinkVersion::V2,
    })
}

Where the to_socket_addrs.unwrap() can Panic.

example of backtrace:

thread 'x' panicked at /home/joaoantoniocardoso/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mavlink-0.10.4/src/connection/tcp.rs:29:10:
called `Result::unwrap()` on an `Err` value: Custom { kind: Uncategorized, error: "failed to lookup address information: Temporary failure in name resolution" }
stack backtrace:
   0:     0x5625bfdefc7c - std::backtrace_rs::backtrace::libunwind::trace::ha69d38c49f1bf263
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5625bfdefc7c - std::backtrace_rs::backtrace::trace_unsynchronized::h93125d0b85fd543c
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5625bfdefc7c - std::sys_common::backtrace::_print_fmt::h8d65f438e8343444
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x5625bfdefc7c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h41751d2af6c8033a
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5625bfe1ddac - core::fmt::rt::Argument::fmt::h5db2f552d8a28f63
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/rt.rs:138:9
   5:     0x5625bfe1ddac - core::fmt::write::h99465148a27e4883
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/mod.rs:1114:21
   6:     0x5625bfdec01e - std::io::Write::write_fmt::hee8dfd57bd179ab2
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/io/mod.rs:1763:15
   7:     0x5625bfdefa64 - std::sys_common::backtrace::_print::h019a3cee3e814da4
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5625bfdefa64 - std::sys_common::backtrace::print::h55694121c2ddf918
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5625bfdf1313 - std::panicking::default_hook::{{closure}}::h29cbe3da3891b0b0
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:272:22
  10:     0x5625bfdf1034 - std::panicking::default_hook::h881e76b2b8c74280
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:292:9
  11:     0x5625bfdf1895 - std::panicking::rust_panic_with_hook::hcc36e25b6e33969c
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:731:13
  12:     0x5625bfdf1791 - std::panicking::begin_panic_handler::{{closure}}::ha415efb0f69f41f9
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:609:13
  13:     0x5625bfdf01a6 - std::sys_common::backtrace::__rust_end_short_backtrace::h395fe90f99451e4e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x5625bfdf14e2 - rust_begin_unwind
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
  15:     0x5625be153695 - core::panicking::panic_fmt::h452a83e54ecd764e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
  16:     0x5625be153c63 - core::result::unwrap_failed::hed0fccbe07e724fc
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1652:5
  17:     0x5625be1786d4 - core::result::Result<T,E>::unwrap::h7228e1c09352896a
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1077:23
  18:     0x5625be501998 - mavlink::connection::tcp::tcpout::h2d784a6bf21d8502
                               at /home/joaoantoniocardoso/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mavlink-0.10.4/src/connection/tcp.rs:27:16
  19:     0x5625be5010c6 - mavlink::connection::tcp::select_protocol::hcc4ddc2605f75d80
                               at /home/joaoantoniocardoso/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mavlink-0.10.4/src/connection/tcp.rs:15:21
  20:     0x5625be8c9c75 - mavlink::connection::connect::h3b1548f00cdd7ce1
                               at /home/joaoantoniocardoso/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mavlink-0.10.4/src/connection/mod.rs:75:13
  21:     0x5625be80b0d2 - mavlink_camera_manager::mavlink::manager::Connection::connect::h7ebdc36e99b99076
                               at /home/joaoantoniocardoso/BlueRobotics/mavlink-camera-manager/src/mavlink/manager.rs:222:19
  22:     0x5625be8031d8 - mavlink_camera_manager::mavlink::manager::Manager::receiver_loop::h3390aeab506216b3
                               at /home/joaoantoniocardoso/BlueRobotics/mavlink-camera-manager/src/mavlink/manager.rs:120:42
  23:     0x5625be30b86a - <mavlink_camera_manager::mavlink::manager::Manager as core::default::Default>::default::{{closure}}::h68f053f4a5c44507
                               at /home/joaoantoniocardoso/BlueRobotics/mavlink-camera-manager/src/mavlink/manager.rs:59:28
  24:     0x5625be3c352e - std::sys_common::backtrace::__rust_begin_short_backtrace::ha58633fccff8c695
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:154:18
  25:     0x5625be6afffa - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::hfc229ebf972e7997
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/thread/mod.rs:529:17
  26:     0x5625be83a32e - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::he98140c6ee3e3bfb
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panic/unwind_safe.rs:271:9
  27:     0x5625be4c573b - std::panicking::try::do_call::hd491a6729dd5100f
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:504:40
  28:     0x5625be4d6a1b - __rust_try
  29:     0x5625be4bd7da - std::panicking::try::hce41a22c34be1b0a
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:468:19
  30:     0x5625be6af6f4 - std::panic::catch_unwind::h11a08d8f2be4da05
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panic.rs:142:14
  31:     0x5625be6af6f4 - std::thread::Builder::spawn_unchecked_::{{closure}}::hcdb57dfed89e5238
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/thread/mod.rs:528:30
  32:     0x5625be25d03e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h4b2a921e2b51d148
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:250:5
  33:     0x5625bfdf5455 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51435299acd7166e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2007:9
  34:     0x5625bfdf5455 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3f833c0a4926bdd4
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2007:9
  35:     0x5625bfdf5455 - std::sys::unix::thread::Thread::new::thread_start::h2c486d0230ab0d99
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys/unix/thread.rs:108:17
  36:     0x7f99b6caa9eb - <unknown>
  37:     0x7f99b6d2e7cc - <unknown>
  38:                0x0 - <unknown>
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.

1 participant