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

deps: update webrtc to 0.11.0 #5448

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

deps: update webrtc to 0.11.0 #5448

wants to merge 11 commits into from

Conversation

jxs
Copy link
Member

@jxs jxs commented Jun 6, 2024

Description

@b-zee
Copy link
Contributor

b-zee commented Jul 18, 2024

EDIT: Solved, see later comment.

Hey @jxs, I saw this PR as I was debugging some weird aarch64 cross compilation error for a outdated ring dependency. Following the dependency tree it appeared that my libp2p_webrtc dependency pulls that in, so it appears this PR fixes that 👍 .

However, I get the following error now and I can't quite figure it out:

error[E0599]: the method `map` exists for struct `Transport`, but its trait bounds were not satisfied
   --> src/network/mod.rs:155:14
    |
151 |               Ok(libp2p_webrtc::tokio::Transport::new(
    |  ________________-
152 | |                 key.clone(),
153 | |                 libp2p_webrtc::tokio::Certificate::generate(&mut rand::thread_rng())?,
154 | |             )
155 | |             .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))))
    | |             -^^^ method cannot be called on `Transport` due to unsatisfied trait bounds
    | |_____________|
    | 
    |
   ::: /home/b-zee/.cargo/git/checkouts/rust-libp2p-bd8662eba582499b/3180f88/transports/webrtc/src/tokio/transport.rs:49:1
    |
49  |   pub struct Transport {
    |   -------------------- doesn't satisfy 5 bounds
    |
    = note: the following trait bounds were not satisfied:
            `libp2p_webrtc::tokio::Transport: futures::Future`
            which is required by `libp2p_webrtc::tokio::Transport: futures::FutureExt`
            `libp2p_webrtc::tokio::Transport: futures::Stream`
            which is required by `libp2p_webrtc::tokio::Transport: futures::StreamExt`
            `&libp2p_webrtc::tokio::Transport: futures::Future`
            which is required by `&libp2p_webrtc::tokio::Transport: futures::FutureExt`
            `&libp2p_webrtc::tokio::Transport: futures::Stream`
            which is required by `&libp2p_webrtc::tokio::Transport: futures::StreamExt`
            `&mut libp2p_webrtc::tokio::Transport: futures::Future`
            which is required by `&mut libp2p_webrtc::tokio::Transport: futures::FutureExt`
            `&mut libp2p_webrtc::tokio::Transport: futures::Stream`
            which is required by `&mut libp2p_webrtc::tokio::Transport: futures::StreamExt`
            `libp2p_webrtc::tokio::Transport: Iterator`
            which is required by `&mut libp2p_webrtc::tokio::Transport: Iterator`
    = help: items from traits can only be used if the trait is in scope
help: trait `Transport` which provides `map` is implemented but not in scope; perhaps you want to import it
    |
1   + use libp2p_core::transport::Transport;
    |

It's basically from the SwarmBuilder::with_other_transport:

        // ...
        .with_other_transport(|key| {
            Ok(libp2p_webrtc::tokio::Transport::new(
                key.clone(),
                libp2p_webrtc::tokio::Certificate::generate(&mut rand::thread_rng())?,
            )
            .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))))
        })

I confirmed that this is only happening when switching from 0.7.1-alpha to this PR's 0.7.2-alpha. Using the following in Cargo.toml:

[patch.crates-io]
libp2p-webrtc = { git = "https://github.com/jxs/rust-libp2p", branch = "update-webrtc" }

@b-zee
Copy link
Contributor

b-zee commented Jul 19, 2024

Sorry for the previous comment. Seems like it was a distraction not related to this PR. I also had to patch the libp2p dep. Presumably otherwise the traits/structs do not line up. This is something the Rust compiler doesn't clearly convey yet apparently.

[patch.crates-io]
libp2p = { git = "https://github.com/jxs/rust-libp2p", branch = "update-webrtc" }
libp2p-webrtc = { git = "https://github.com/jxs/rust-libp2p", branch = "update-webrtc" }
libp2p-webrtc-websys = { git = "https://github.com/jxs/rust-libp2p", branch = "update-webrtc" }

@jxs jxs mentioned this pull request Sep 5, 2024
4 tasks
@mangolas
Copy link

rcgen 0.11 depends on ring 0.16.20 and that ring version does not compile on windows uwp arm64, so we are not able to use quic transport on that platform, which is somewhat a problem to us. Is there anything to help on getting rcgen update to happen and is this the branch that would be best candidate for getting merged?

@jxs
Copy link
Member Author

jxs commented Dec 12, 2024

hi @mangolas thanks for your interest! there's #5591 for rcgen but it seems idle, would you like to take it over? Ping there if so.
meanwhile going to update this one to reflect that.
Thanks!

@jxs jxs closed this Dec 12, 2024
@jxs jxs reopened this Dec 12, 2024
@mangolas
Copy link

@jxs I was trying to wrap my head around the details for getting the rcgen updated to latest and seeing what happens and applying by hand same changes from (#5591). It leads for needing to update webrtc, and the end result is what this PR already contains.

So I'm bit confused what there would be to do apart just get this PR merged and just close #5591 ?

@jxs
Copy link
Member Author

jxs commented Jan 24, 2025

@jxs I was trying to wrap my head around the details for getting the rcgen updated to latest and seeing what happens and applying by hand same changes from (#5591). It leads for needing to update webrtc, and the end result is what this PR already contains.

So I'm bit confused what there would be to do apart just get this PR merged and just close #5591 ?

Hi Lassi, yeah I noticed that while giving another go at this PR some weeks ago. Sorry for the confusion I have meanwhile closed #5591.
The problem with this one is that the smoke tests fail and I haven't yet had time to look into it. If you wanna look into it ofc feel free to do it!

@mangolas
Copy link

Thanks @jxs, I will try to reproduce the smoke test failure locally to see if there is anything I could do.

@mangolas
Copy link

I did run failing test of this branch locally (on macOs), but I could not reproduce the failure, and I don't have rights to trigger the CI to re-run tests to see if it's just flaky test (seems test failure is a timeout: https://github.com/libp2p/rust-libp2p/actions/runs/12953210303/job/36132382210?pr=5448).

@jxs
Copy link
Member Author

jxs commented Jan 28, 2025

I did run failing test of this branch locally (on macOs), but I could not reproduce the failure, and I don't have rights to trigger the CI to re-run tests to see if it's just flaky test (seems test failure is a timeout: https://github.com/libp2p/rust-libp2p/actions/runs/12953210303/job/36132382210?pr=5448).

Yeah Locally I could not reproduce the issue as well, only on CI, but it's not a flaky test it definitely reproduces deterministically.
I think you can run the CI on your own fork right?

@mangolas
Copy link

Yeah Locally I could not reproduce the issue as well, only on CI, but it's not a flaky test it definitely reproduces deterministically.
I think you can run the CI on your own fork right?

I can! Somehow wasn't thinking of that... And can indeed reproduce the problem in CI ubuntu runner. Let's see if I can get any sensible reason for the test failure.

@mangolas
Copy link

mangolas commented Jan 28, 2025

It seems to be something to do how libp2p-webrtc smoke test tries to make local nodes to connect to each other using STUN in Webrtc ICE module. I have enabled trace logging and below are examples of sequence of discovery logs that keeps on repeating until it times out. Problem has to be something to do with either x86 platform or the Github runner network conditions, I tried running the PR locally on arm64 using Ubuntu 24.04 in Docker, and smoke test works fine.

I'm not very familiar on under the hood workings of ICE and STUN and where to look further, but maybe the following logs gives some clues to someone who has more knowledge on what should or shouldn't happen.

This uses the 0.12 version of webrtc which is what the PR uses.

2025-01-28T14:17:37.815873Z TRACE webrtc::peer_connection: start_transports: ice_role=controlled, dtls_role=auto 2025-01-28T14:17:37.815920Z DEBUG webrtc_ice::agent::agent_internal: Started agent: isControlling? false, remoteUfrag: libp2p+webrtc+v1/Ld7q37HEpYGpmCyGxMMqS1lmMd1lJL3szdminGrpSs34pGEF7lPyxaz63dZ07qiT, remotePwd: libp2p+webrtc+v1/Ld7q37HEpYGpmCyGxMMqS1lmMd1lJL3szdminGrpSs34pGEF7lPyxaz63dZ07qiT 2025-01-28T14:17:37.815948Z INFO webrtc_ice::agent::agent_internal: [controlled]: Setting new connection state: Checking 2025-01-28T14:17:37.815988Z INFO webrtc_mdns::conn: Looping and listening Ok(224.0.0.251:5353) 2025-01-28T14:17:37.816046Z INFO webrtc::peer_connection: ICE connection state changed: checking 2025-01-28T14:17:37.816068Z INFO webrtc::peer_connection: peer connection state changed: connecting 2025-01-28T14:17:37.816715Z DEBUG webrtc_ice::agent::agent_internal: [controlled]: adding a new peer-reflexive candidate: 127.0.0.1:44343 2025-01-28T14:17:37.816758Z TRACE webrtc_ice::agent::agent_internal: [controlled]: inbound STUN (Request) from 127.0.0.1:44343 to udp4 host 10.1.0.5:37494 2025-01-28T14:17:37.817059Z DEBUG libp2p_webrtc::tokio::udp_mux: Registered address for connection address=127.0.0.1:44343 connection=libp2p+webrtc+v1/Ld7q37HEpYGpmCyGxMMqS1lmMd1lJL3szdminGrpSs34pGEF7lPyxaz63dZ07qiT 2025-01-28T14:17:37.817270Z TRACE webrtc_ice::agent::agent_internal: [controlled]: ping STUN from udp4 host 10.1.0.5:37494 to udp4 prflx 127.0.0.1:44343 related :0 2025-01-28T14:17:37.817565Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 host 127.0.0.1:37494 to udp4 host 10.1.0.5:44343 2025-01-28T14:17:37.817600Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 6301790883814279828 (local, prio 2130706431) udp4 host 10.1.0.5:44343 <-> udp4 host 127.0.0.1:37494 (remote, prio 1467250027), p.state: 4, isUseCandidate: false, true 2025-01-28T14:17:37.817745Z TRACE webrtc_ice::agent::agent_internal: [controlling]: inbound STUN (Request) from 127.0.0.1:37494 to udp4 host 10.1.0.5:44343 2025-01-28T14:17:37.817936Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: sendBindingSuccess 2025-01-28T14:17:37.817970Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: after findPair prio 6301790883814279828 (local, prio 2130706431) udp4 host 10.1.0.5:44343 <-> udp4 host 127.0.0.1:37494 (remote, prio 1467250027), p.state: 4, true 2025-01-28T14:17:37.817998Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: getBestAvailableCandidatePair prio 6301790883814279828 (local, prio 2130706431) udp4 host 10.1.0.5:44343 <-> udp4 host 127.0.0.1:37494 (remote, prio 1467250027) 2025-01-28T14:17:37.818018Z TRACE webrtc_ice::agent::agent_selector: The candidate (udp4 host 10.1.0.5:44343, udp4 host 127.0.0.1:37494) is the best candidate available, marking it as nominated 2025-01-28T14:17:37.818129Z TRACE webrtc_ice::agent::agent_selector: ping STUN (nominate candidate pair from udp4 host 10.1.0.5:44343 to udp4 host 127.0.0.1:37494 2025-01-28T14:17:37.818153Z TRACE webrtc_ice::agent::agent_internal: [controlling]: ping STUN from udp4 host 10.1.0.5:44343 to udp4 host 127.0.0.1:37494 2025-01-28T14:17:37.818403Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 prflx 127.0.0.1:44343 related :0 to udp4 host 172.17.0.1:37494 2025-01-28T14:17:37.818437Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 7998392936314175487 (local, prio 2130706431) udp4 host 172.17.0.1:37494 <-> udp4 prflx 127.0.0.1:44343 related :0 (remote, prio 1862270975) 2025-01-28T14:17:37.818690Z TRACE webrtc_ice::agent::agent_internal: [controlled]: inbound STUN (Request) from 127.0.0.1:44343 to udp4 host 10.1.0.5:37494 2025-01-28T14:17:37.818814Z TRACE webrtc_ice::agent::agent_internal: [controlled]: ping STUN from udp4 host 10.1.0.5:37494 to udp4 prflx 127.0.0.1:44343 related :0 2025-01-28T14:17:37.819109Z TRACE webrtc_ice::agent::agent_internal: [controlling]: inbound STUN (Request) from 127.0.0.1:37494 to udp4 host 172.17.0.1:44343 2025-01-28T14:17:37.819294Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: sendBindingSuccess 2025-01-28T14:17:37.819346Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: after findPair prio 6301790883814279828 (local, prio 2130706431) udp4 host 172.17.0.1:44343 <-> udp4 host 127.0.0.1:37494 (remote, prio 1467250027), p.state: 2, false 2025-01-28T14:17:37.819545Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 prflx 127.0.0.1:44343 related :0 to udp4 host 172.17.0.1:37494 2025-01-28T14:17:37.819577Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 7998392936314175487 (local, prio 2130706431) udp4 host 172.17.0.1:37494 <-> udp4 prflx 127.0.0.1:44343 related :0 (remote, prio 1862270975) 2025-01-28T14:17:38.018080Z TRACE webrtc_ice::agent::agent_selector: ping STUN (nominate candidate pair from udp4 host 10.1.0.5:44343 to udp4 host 127.0.0.1:37494 2025-01-28T14:17:38.018116Z TRACE webrtc_ice::agent::agent_internal: [controlling]: ping STUN from udp4 host 10.1.0.5:44343 to udp4 host 127.0.0.1:37494 2025-01-28T14:17:38.018633Z TRACE webrtc_ice::agent::agent_internal: [controlled]: inbound STUN (Request) from 127.0.0.1:44343 to udp4 host 10.1.0.5:37494 2025-01-28T14:17:38.018820Z TRACE webrtc_ice::agent::agent_internal: [controlled]: ping STUN from udp4 host 10.1.0.5:37494 to udp4 prflx 127.0.0.1:44343 related :0 2025-01-28T14:17:38.019163Z TRACE webrtc_ice::agent::agent_internal: [controlling]: inbound STUN (Request) from 127.0.0.1:37494 to udp4 host 10.1.0.5:44343 2025-01-28T14:17:38.019409Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: sendBindingSuccess

I also tried to use master version of webrtc which fails as well, but the ice part has been changed, so the logs reveal bit different information.

2025-01-28T16:39:24.326558Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Sending 2025-01-28T16:39:24.326674Z TRACE webrtc_dtls::conn: Send [handshake:client] -> ClientHello (epoch: 0, seq: 0) 2025-01-28T16:39:24.326979Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Waiting 2025-01-28T16:39:24.332317Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:24.332471Z TRACE webrtc_ice::agent::agent_internal: [controlling]: ping STUN from udp4 host 10.1.0.18:47888 to udp4 host 127.0.0.1:59777 2025-01-28T16:39:24.332817Z TRACE webrtc_ice::agent::agent_internal: [controlled]: inbound STUN (Request) from 127.0.0.1:47888 to udp4 host 172.17.0.1:59777 2025-01-28T16:39:24.333157Z TRACE webrtc_ice::agent::agent_internal: [controlled]: ping STUN from udp4 host 172.17.0.1:59777 to udp4 prflx 127.0.0.1:47888 related :0 2025-01-28T16:39:24.333405Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 host 127.0.0.1:59777 to udp4 host 172.17.0.1:47888 2025-01-28T16:39:24.333442Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 6301790883814279828 (local, prio 2130706431) udp4 host 172.17.0.1:47888 <-> udp4 host 127.0.0.1:59777 (remote, prio 1467250027), p.state: 4, isUseCandidate: false, false 2025-01-28T16:39:24.333552Z TRACE webrtc_ice::agent::agent_internal: [controlling]: inbound STUN (Request) from 127.0.0.1:59777 to udp4 host 172.17.0.1:47888 2025-01-28T16:39:24.333728Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: sendBindingSuccess 2025-01-28T16:39:24.333763Z TRACE webrtc_ice::agent::agent_selector: controllingSelector: after findPair prio 6301790883814279828 (local, prio 2130706431) udp4 host 172.17.0.1:47888 <-> udp4 host 127.0.0.1:59777 (remote, prio 1467250027), p.state: 4, false 2025-01-28T16:39:24.333938Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 prflx 127.0.0.1:47888 related :0 to udp4 host 10.1.0.18:59777 2025-01-28T16:39:24.333971Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 7998392936314175487 (local, prio 2130706431) udp4 host 10.1.0.18:59777 <-> udp4 prflx 127.0.0.1:47888 related :0 (remote, prio 1862270975) 2025-01-28T16:39:24.533483Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:24.735008Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:24.935617Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:25.137176Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:25.327644Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1 retransmit_timer 2025-01-28T16:39:25.327683Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Sending 2025-01-28T16:39:25.327796Z TRACE webrtc_dtls::conn: Send [handshake:client] -> ClientHello (epoch: 0, seq: 0) 2025-01-28T16:39:25.328123Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Waiting 2025-01-28T16:39:25.337471Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:25.538955Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:25.739499Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:25.940959Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:26.141435Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:26.328821Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1 retransmit_timer 2025-01-28T16:39:26.328854Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Sending 2025-01-28T16:39:26.328964Z TRACE webrtc_dtls::conn: Send [handshake:client] -> ClientHello (epoch: 0, seq: 0) 2025-01-28T16:39:26.329296Z TRACE webrtc_dtls::handshaker: [handshake:client] Flight 1: Waiting 2025-01-28T16:39:26.342801Z TRACE webrtc_ice::agent::agent_selector: [controlling]: checking keepalive 2025-01-28T16:39:26.342976Z TRACE webrtc_ice::agent::agent_internal: [controlling]: ping STUN from udp4 host 10.1.0.18:47888 to udp4 host 127.0.0.1:59777 2025-01-28T16:39:26.343042Z TRACE webrtc_ice::agent::agent_internal: [controlling]: Discarded 1 binding requests because they expired 2025-01-28T16:39:26.343392Z TRACE webrtc_ice::agent::agent_internal: [controlled]: inbound STUN (Request) from 127.0.0.1:47888 to udp4 host 172.17.0.1:59777 2025-01-28T16:39:26.343731Z TRACE webrtc_ice::agent::agent_internal: [controlled]: ping STUN from udp4 host 172.17.0.1:59777 to udp4 prflx 127.0.0.1:47888 related :0 2025-01-28T16:39:26.344059Z TRACE webrtc_ice::agent::agent_selector: inbound STUN (SuccessResponse) from udp4 host 127.0.0.1:59777 to udp4 host 10.1.0.18:47888 2025-01-28T16:39:26.344094Z TRACE webrtc_ice::agent::agent_selector: Found valid candidate pair: prio 6301790883814279828 (local, prio 2130706431) udp4 host 10.1.0.18:47888 <-> udp4 host 127.0.0.1:59777 (remote, prio 1467250027), p.state: 4, isUseCandidate: false, false 2025-01-28T16:39:26.344202Z TRACE webrtc_ice::agent::agent_internal: [controlling]: inbound STUN (Request) from 127.0.0.1:59777 to udp4 host 10.1.0.18:47888

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 this pull request may close these issues.

4 participants