LooseLab / Icarust

A fully featured MinKNOW simulator for testing read until experiments.
Mozilla Public License 2.0
17 stars 7 forks source link

Error in `tonic::transport` - `"Address family not supported by protocol"` #23

Closed SimiliSerpent closed 4 months ago

SimiliSerpent commented 4 months ago

Dear Icarust maintainers,

I have an issue while trying to use Icarust under a new environment. I get the following error, with full Rust backtrace:

[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1414 ] Barcodes available []
thread 'tokio-runtime-worker' panicked at src/main.rs:375:14:
called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 97, kind: Uncategorized, message: "Address family not supported by protocol" }))
stack backtrace:
   0:     0x5649456db45c - std::backtrace_rs::backtrace::libunwind::trace::he43a6a3949163f8c
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5649456db45c - std::backtrace_rs::backtrace::trace_unsynchronized::h50db52ca99f692e7
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5649456db45c - std::sys_common::backtrace::_print_fmt::hd37d595f2ceb2d3c
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x5649456db45c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h678bbcf9da6d7d75
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x564945706acc - core::fmt::rt::Argument::fmt::h3a159adc080a6fc9
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/rt.rs:138:9
   5:     0x564945706acc - core::fmt::write::hb8eaf5a8e45a738e
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/mod.rs:1094:21
   6:     0x5649456d7b6e - std::io::Write::write_fmt::h9663fe36b2ee08f9
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/io/mod.rs:1714:15
   7:     0x5649456db244 - std::sys_common::backtrace::_print::hcd4834796ee88ad2
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5649456db244 - std::sys_common::backtrace::print::h1360e9450e4f922a
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5649456dcb33 - std::panicking::default_hook::{{closure}}::h2609fa95cd5ab1f4
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:270:22
  10:     0x5649456dc84c - std::panicking::default_hook::h6d75f5747cab6e8d
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:290:9
  11:     0x5649456dd0b9 - std::panicking::rust_panic_with_hook::h57e78470c47c84de
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:707:13
  12:     0x5649456dcfb7 - std::panicking::begin_panic_handler::{{closure}}::h3dfd2453cf356ecb
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:599:13
  13:     0x5649456db986 - std::sys_common::backtrace::__rust_end_short_backtrace::hdb177d43678e4d7e
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x5649456dcd02 - rust_begin_unwind
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
  15:     0x56494522ced3 - core::panicking::panic_fmt::hd1e971d8d7c78e0e
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
  16:     0x56494522d2da - core::result::unwrap_failed::hccb456d39e9c31fc
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
  17:     0x5649452930e4 - icarust::main::{{closure}}::{{closure}}::hc9e9d80c7f2ff29b
  18:     0x56494528a44e - tokio::runtime::task::core::Core<T,S>::poll::he53530b31ac4210d
  19:     0x56494531d380 - tokio::runtime::task::harness::Harness<T,S>::poll::h3a0545bb46a54023
  20:     0x56494565a28b - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::hfc8f576ec0734923
  21:     0x56494565943e - tokio::runtime::scheduler::multi_thread::worker::Context::run::hfe06a7e16e1ac7cb
  22:     0x56494565ff27 - tokio::runtime::context::scoped::Scoped<T>::set::h0f28f86854fb143e
  23:     0x564945658b02 - tokio::runtime::scheduler::multi_thread::worker::run::h9022b25d86670d28
  24:     0x56494565449a - tokio::runtime::task::core::Core<T,S>::poll::haafb339648cf5401
  25:     0x56494564097e - tokio::runtime::task::harness::Harness<T,S>::poll::hc31b6dcf69772f2d
  26:     0x56494564fb03 - tokio::runtime::blocking::pool::Inner::run::h9e9dea3af0865a69
  27:     0x564945641575 - std::sys_common::backtrace::__rust_begin_short_backtrace::hb59f71c45039d637
  28:     0x564945641c99 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0a7201ff7dfcd621
  29:     0x5649456dfec5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haadd4e5af2ab0d62
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
  30:     0x5649456dfec5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he4ba1fb09c16d807
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
  31:     0x5649456dfec5 - std::sys::unix::thread::Thread::new::thread_start::he524ecf4b47bee95
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys/unix/thread.rs:108:17
  32:     0x14f6d33101ca - start_thread
  33:     0x14f6d29f6e73 - clone
  34:                0x0 - <unknown>
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 808 ] "<PATH_TO_REF>/references/omicron.fa"
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1119 ] Reading sequence information for Some(
    "omicron.fa",
) for sample Sample {
    name: "SARS_COV_2",
    input_genome: "<PATH_TO_REF>/references/omicron.fa",
    mean_read_length: Some(
        5000.0,
    ),
    weight: 1,
    weights_files: None,
    amplicon: None,
    barcodes: None,
    barcode_weights: None,
    uneven: None,
} MAY TAKE SOME TIME
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1134 ] Simulating for 1 sequences
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1142 ] Converting omicron
[00:00:00] ########################################   29743/29743   done
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1165 ] Finished converting 1 of 1 in 0.017939528 seconds
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1171 ] Read reference into squiggle in 0.017972638 seconds
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 808 ] "<PATH_TO_REF>/references/GCA_000005845.fa"
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1119 ] Reading sequence information for Some(
    "GCA_000005845.fa",
) for sample Sample {
    name: "ESCHERICHIA_COLI",
    input_genome: "<PATH_TO_REF>/references/GCA_000005845.fa",
    mean_read_length: Some(
        5000.0,
    ),
    weight: 150,
    weights_files: None,
    amplicon: None,
    barcodes: None,
    barcode_weights: None,
    uneven: None,
} MAY TAKE SOME TIME
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1134 ] Simulating for 1 sequences
[2024-07-09T08:16:07Z INFO icarust::impl_services::data: 1142 ] Converting U00096_3 Escherichia coli str. K-12 substr. MG1655, complete genome
[00:00:02] ######################################## 4641643/4641643 done
[2024-07-09T08:16:10Z INFO icarust::impl_services::data: 1165 ] Finished converting 1 of 1 in 2.407489018 seconds
[2024-07-09T08:16:10Z INFO icarust::impl_services::data: 1171 ] Read reference into squiggle in 2.408662126 seconds
[2024-07-09T08:16:10Z INFO icarust::impl_services::data: 1436 ] Death chances {
    "SARS_COV_2": DeathChance {
        base_chance: 0.013455,
        mean_read_length: 5000.0,
    },
    "ESCHERICHIA_COLI": DeathChance {
        base_chance: 0.013455,
        mean_read_length: 5000.0,
    },
}
Error: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 97, kind: Uncategorized, message: "Address family not supported by protocol" }))

I found out that IPv6 is disabled under that environment. I thought maybe Icarust / the minknow API is using it, so I replaced localhost in the code with 127.0.0.1, recompiled icarust and ran it again, but still the same error occurs. Do you have any hint why? Can you try to disable IPv6 and see what happens? (I do not have the rights to do so under my working env)

Thank you for your help Ben

_To give you some context, I had to change my working environment because the previous GPU was too old to handle recent Dorado (dorado_basecall_server) releases, hence why I am unable to test and close the issue #16_

SimiliSerpent commented 4 months ago

I am not an expert, but I think the problem was caused by Icarust listening to every adresses, using IPv6 formatting. Maybe the other interfaces of my computing node, which are different from IPv4/IPv6, caused this Address family not supported issue?

Replacing lines 305 & 306 of Icarust/src/main.rs:

305    let addr_manager = format!("[::0]:{}", m_port).parse().unwrap();
306    let addr_position: SocketAddr = format!("[::0]:{}", a_port).parse().unwrap();

by:

305    let addr_manager = format!("127.0.0.1:{}", m_port).parse().unwrap();
306    let addr_position: SocketAddr = format!("127.0.0.1:{}", a_port).parse().unwrap();

solved the error.

I will check if it is still able to communicate with ReadFish ASAP. Ben

SimiliSerpent commented 4 months ago

For the sake of completeness: yes, it still communicates well with ReadFish.

Ben

Adoni5 commented 4 months ago

Hey Ben,

I have no idea how I managed this but I never saw this issue until just now! You'll have to forgive me, I am deep in Thesis mode. That's very interesting - I'm also no expert - and the [::0] shortcut is super opaque to me. When I get the chance I will add something to the documentation about this!

Thanks, Rory

SimiliSerpent commented 4 months ago

Hi Rory,

Stay strong and good luck for the Thesis! Given the work accomplished here, no doubt it will be fine :-) (still have a few years ahead to complete mine.. ... ..)

Ben