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

mdns storm #616

Open
ineiti opened this issue Oct 1, 2024 · 5 comments · Fixed by #636
Open

mdns storm #616

ineiti opened this issue Oct 1, 2024 · 5 comments · Fixed by #636
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ineiti
Copy link
Contributor

ineiti commented Oct 1, 2024

I'm using the latest version of the webrtc crate to connect nodes between servers and webclients. Recently I had problems in my home network, and it turned out that my nodes running on my server using webrtc create mdns storms:

08:32:16.365924 fwpr100p0 Out IP fricklebox.fritz.box.mdns > mdns.mcast.net.mdns: 0 A (QM)? 53854a1e-1c02-4df1-932a-c3f8bad7784f.local. (60)
08:32:16.365924 fwpr100p0 Out IP fricklebox.fritz.box.mdns > mdns.mcast.net.mdns: 0 A (QM)? 53854a1e-1c02-4df1-932a-c3f8bad7784f.local. (60)
08:32:16.365926 eno4  Out IP fricklebox.fritz.box.mdns > mdns.mcast.net.mdns: 0 A (QM)? 53854a1e-1c02-4df1-932a-c3f8bad7784f.local. (60)
08:32:16.365928 eno1  Out IP fricklebox.fritz.box.mdns > mdns.mcast.net.mdns: 0 A (QM)? 53854a1e-1c02-4df1-932a-c3f8bad7784f.local. (60)
08:32:16.365928 eno4  Out IP fricklebox.fritz.box.mdns > mdns.mcast.net.mdns: 0 A (QM)? 53854a1e-1c02-4df1-932a-c3f8bad7784f.local. (60)

Lots and lots of them. If I correlated this correctly, it tries to find the mdns of a remote web-client, which will never be in the local network.

Is there something to do to calm down these mdns storms? I tried to look how to configure the mdns part in the documentation, but didn't find how to do that.

The nodes are running in a docker container - might this impact how mdns interacts with the network?

@ineiti
Copy link
Contributor Author

ineiti commented Oct 1, 2024

I added the following lines to the setup of the APIBuilder from the /examples directory. I'm not really sure what the consequences of it are with regard to running it on the local network. I guess it still will manage to find the nodes locally.

Also not sure if I should keep the issue open or not. Without turning off the mdns module, I still have the flood of messages.

        // There seems to be some trouble with mdns where it can flood the local network
        // with requests - so turn it off.
        let mut setting_engine = SettingEngine::default();
        setting_engine.set_ice_multicast_dns_mode(MulticastDnsMode::Disabled);

        // Create the API object with the MediaEngine
        let api = APIBuilder::new()
            .with_media_engine(m)
            .with_interceptor_registry(registry)
            .with_setting_engine(setting_engine)
            .build();

@r-byondlabs
Copy link

I see lot of mdns error messages when a peer connection is closed. It seems like the mdns connection is not stopped when the peer connection is closed. Tracking down the call from peer_connection.stop() leads to here:

pub async fn close(&self) -> Result<()> {

I think this should have a close_multicast_conn() here somewhere.

I'm disabling mdns for now using the above method.

ineiti added a commit to ineiti/webrtc that referenced this issue Nov 20, 2024
I use the library with many open/close, and I get mdns storms where the webrtc library searches for other nodes over the network in a very aggressive manner.

This has been proposed by @r-byondlabs, and might very well be the problem: if I open/close many connections, and the mdns-agents are not cleaned up, there might be many requests.

Fixes webrtc-rs#616
@ineiti
Copy link
Contributor Author

ineiti commented Nov 20, 2024

Ah, that might be it. My nodes do reconnect quite often, which might lead to having lots of mdns requests going on.

I didn't try it out yet, but here is a PR: #636

@r-byondlabs - is that what you think should happen?

@r-byondlabs
Copy link

@ineiti yup, seems right to be me 👍🏽

ineiti added a commit to ineiti/webrtc that referenced this issue Nov 20, 2024
I use the library with many open/close, and I get mdns storms where the webrtc library searches for other nodes over the network in a very aggressive manner.

This has been proposed by @r-byondlabs, and might very well be the problem: if I open/close many connections, and the mdns-agents are not cleaned up, there might be many requests.

Fixes webrtc-rs#616
ineiti added a commit to ineiti/webrtc that referenced this issue Nov 21, 2024
I use the library with many open/close, and I get mdns storms where the webrtc library searches for other nodes over the network in a very aggressive manner.

This has been proposed by @r-byondlabs, and might very well be the problem: if I open/close many connections, and the mdns-agents are not cleaned up, there might be many requests.

Fixes webrtc-rs#616
tubzby pushed a commit to tubzby/webrtc-rs that referenced this issue Nov 26, 2024
I use the library with many open/close, and I get mdns storms where the webrtc library searches for other nodes over the network in a very aggressive manner.

This has been proposed by @r-byondlabs, and might very well be the problem: if I open/close many connections, and the mdns-agents are not cleaned up, there might be many requests.

Fixes webrtc-rs#616
@ineiti
Copy link
Contributor Author

ineiti commented Dec 9, 2024

Unfortunately this doesn't fix it - I just had the same problem as above with the printer not being reachable due to excessive mDNS packets from webrtc...

@rainliu - can you re-open this issue? Or shall I create a new one?

@rainliu rainliu reopened this Dec 9, 2024
@rainliu rainliu added enhancement New feature or request bug Something isn't working labels Dec 10, 2024
@rainliu rainliu self-assigned this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants