rust-libp2p: Hole-punching tutorial appears to trigger panic in listening client, preventing completion
Summary
Hello, I’m new to your wonderful library, apologies if I’ve made some rookie mistake. I’m encountering a frustrating issue with the hole-punching tutorial here wherein the listening client panics with the following message:
thread 'main' panicked at 'ListenerClosed { listener_id: ListenerId(2), addresses: [], reason: Ok(()) }', protocols/dcutr/examples/client.rs:217:26
To the best of my knowledge I’ve followed the tutorial word for word, with an exception of completing the address used for libp2p-lookup.
I’ve compiled both the “client” and “relay_v2” with:
rustc 1.60.0 (7737e0b5c 2022-04-04) on Linux Mint 20.3 Una (base: Ubuntu 20.04 focal)
and deployed relay_v2 to this kind of AWS Lightsail virtual server:
Ubuntu 20.04 LTS 512 MB RAM, 1 vCPU, 20 GB SSD London, Zone A (eu-west-2a)
And opened the following in the AWS firewall:
ICMP 8 0 TCP 4001
So that the suggested ping, telnet, libp2p-lookup tests can complete. (And I’ve checked them, they all complete successfully).
Skimming through the github issues it’s evident other people are getting further in the tutorial, so I’m hoping somebody can help me figure out what’s different in my case .
Expected behavior
Presumably the listening client should continue to run instead of panicking.
Actual behavior
The listening client panics with the aforementioned message. Full logs for both “client” and “relay_v2” follow:
RUST_LOG=info ./relay_v2 --port 4001 --secret-key-seed 0
Debug Output
opt: Opt { use_ipv6: None, secret_key_seed: 0, port: 4001 }
Local peer id: PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN")
Listening on "/ip4/127.0.0.1/tcp/4001"
Listening on "/ip4/172.26.3.110/tcp/4001"
ReservationReqAccepted { src_peer_id: PeerId("12D3KooWPjceQrSwdWXPyLLeABRXmuqt69Rg3sBYbU1Nft9HyQ6X"), renewed: false }
RUST_LOG=info RUST_BACKTRACE=full ./client --secret-key-seed 1 --mode listen --relay-address /ip4/[relay ip removed by me only here on github]/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN
Debug Output
[2022-04-26T11:11:32Z INFO client] Local peer id: PeerId("12D3KooWPjceQrSwdWXPyLLeABRXmuqt69Rg3sBYbU1Nft9HyQ6X")
[2022-04-26T11:11:32Z INFO client] Listening on "/ip4/127.0.0.1/tcp/40855"
[2022-04-26T11:11:32Z INFO client] Listening on "/ip4/192.168.1.21/tcp/40855"
thread 'main' panicked at 'ListenerClosed { listener_id: ListenerId(2), addresses: [], reason: Ok(()) }', protocols/dcutr/examples/client.rs:217:26
stack backtrace:
0: 0x5611173af79d - std::backtrace_rs::backtrace::libunwind::trace::hee598835bc88d35b
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x5611173af79d - std::backtrace_rs::backtrace::trace_unsynchronized::h9cdc730ba5cf5d72
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5611173af79d - std::sys_common::backtrace::_print_fmt::h75aeaf7ed30e43fa
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:66:5
3: 0x5611173af79d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h606862f787600875
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:45:22
4: 0x5611173cfb4c - core::fmt::write::he803f0f418caf762
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/fmt/mod.rs:1190:17
5: 0x5611173a8e38 - std::io::Write::write_fmt::h70bc45872f37e7bb
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/io/mod.rs:1657:15
6: 0x5611173b1c77 - std::sys_common::backtrace::_print::h64d038cf8ac3e13e
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:48:5
7: 0x5611173b1c77 - std::sys_common::backtrace::print::h359300b4a7fccf65
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:35:9
8: 0x5611173b1c77 - std::panicking::default_hook::{{closure}}::hf51be35e2f510149
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:295:22
9: 0x5611173b1940 - std::panicking::default_hook::h03ca0f22e1d2d25e
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:314:9
10: 0x5611173b23c9 - std::panicking::rust_panic_with_hook::h3b7380e99b825b63
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:698:17
11: 0x5611173b20b7 - std::panicking::begin_panic_handler::{{closure}}::h8e849d0710154ce0
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:588:13
12: 0x5611173afc64 - std::sys_common::backtrace::__rust_end_short_backtrace::hedcdaddbd4c46cc5
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:138:18
13: 0x5611173b1dc9 - rust_begin_unwind
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
14: 0x5611167acbd3 - core::panicking::panic_fmt::he1bbc7336d49a357
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
15: 0x561116818ec7 - client::main::{{closure}}::hedaaaebe5fc581f6
at /home/user/IdeaProjects/rust-libp2p-0.44.0/protocols/dcutr/examples/client.rs:217:26
16: 0x56111693137b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2f80e8bbae70e903
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/future/mod.rs:84:19
17: 0x5611167b13d3 - futures_executor::local_pool::block_on::{{closure}}::h08ad678015348e06
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.21/src/local_pool.rs:315:23
18: 0x5611167b0de3 - futures_executor::local_pool::run_executor::{{closure}}::haa21ff67dac7cc5b
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.21/src/local_pool.rs:90:37
19: 0x56111681f8e1 - std::thread::local::LocalKey<T>::try_with::h467f9ae3dee277d2
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/thread/local.rs:413:16
20: 0x56111681f5a3 - std::thread::local::LocalKey<T>::with::h3b780bacb38f875e
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/thread/local.rs:389:9
21: 0x5611167b0bfd - futures_executor::local_pool::run_executor::hc4dc37b6662f625d
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.21/src/local_pool.rs:86:5
22: 0x5611167b129a - futures_executor::local_pool::block_on::h91c66026be49affb
at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.21/src/local_pool.rs:315:5
23: 0x5611168e3c8b - client::main::h30c5dcad6cb56c4f
at /home/user/IdeaProjects/rust-libp2p-0.44.0/protocols/dcutr/examples/client.rs:201:5
24: 0x56111696bb5b - core::ops::function::FnOnce::call_once::hd3072571bb273c2d
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
25: 0x5611168349ae - std::sys_common::backtrace::__rust_begin_short_backtrace::h1b926b1b239e1fbc
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:122:18
26: 0x561116925dd1 - std::rt::lang_start::{{closure}}::h13b08e8db7eff325
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/rt.rs:145:18
27: 0x5611173aee81 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb7014f43484a8b4e
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:259:13
28: 0x5611173aee81 - std::panicking::try::do_call::h7bc9dc436daeb8c7
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:492:40
29: 0x5611173aee81 - std::panicking::try::h653d68a27ff5f175
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:456:19
30: 0x5611173aee81 - std::panic::catch_unwind::h9d739f9f59895e68
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panic.rs:137:14
31: 0x5611173aee81 - std::rt::lang_start_internal::{{closure}}::hf006f2bc7ce22bbe
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/rt.rs:128:48
32: 0x5611173aee81 - std::panicking::try::do_call::hfb39d6df61a2e69f
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:492:40
33: 0x5611173aee81 - std::panicking::try::h13e2d225134958ac
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:456:19
34: 0x5611173aee81 - std::panic::catch_unwind::h3bd49b5a5dfb1a50
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panic.rs:137:14
35: 0x5611173aee81 - std::rt::lang_start_internal::h2ba92edce36c035e
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/rt.rs:128:20
36: 0x561116925da0 - std::rt::lang_start::hcfeca0efa51552de
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/rt.rs:144:17
37: 0x5611168e68ec - main
38: 0x7fe6b23d60b3 - __libc_start_main
39: 0x5611167ade9e - _start
40: 0x0 - <unknown>
Version
- I’m using unaltered rust-libp2p-0.44.0 source downloaded from here
Would you like to work on fixing this bug?
Maybe. (Assuming there actually is a bug and this isn’t all some rookie mistake on my part I’m completely willing to assist in anyway I can, but I haven’t got nearly enough experience in Rust or libp2p to take point on the matter.)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
Commits related to this issue
- protocols/dcutr/example: Wait for relay to accept reservation request When in listening mode, wait for the relay to accept our reservation request. Only then can a client in dialing mode establish a ... — committed to mxinden/rust-libp2p by mxinden 2 years ago
- protocols/dcutr/example: Wait for relay to accept reservation request (#2642) When in listening mode, wait for the relay to accept our reservation request. Only then can a client in dialing mode est... — committed to libp2p/rust-libp2p by mxinden 2 years ago
- protocols/dcutr/example: Wait for relay to accept reservation request (#2642) When in listening mode, wait for the relay to accept our reservation request. Only then can a client in dialing mode est... — committed to santos227/rustlib by santos227 2 years ago
Thanks for bearing with us!
Pinging @mathiversen directly, in case the above is helpful.
Yes, that would be a good option. Will see what I can do in the example code.