go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

mDNS's new implementation doesn't perform as well

Open MichaelMure opened this issue 3 years ago • 7 comments

Sorry, no hard number to provide other than "upgrading to the new implementation makes my test fails all over the place, randomly.

I have a series of go test for my project that simulate locally the interactions of a series of services. Those test rely on mDNS for local discovery.

Until now I had a simple time.Sleep() to give this discovery some time to connect, everything was fine. While updating to a more recent go-libp2p, I changed my code to use the new mDNS implementation, resulting in broken tests. I changed my time.Sleep() by something smarter that wait until the discovery worked, up to a minute, but that doesn't seems to be enough.

It seems to me that often the discovery is slower, and sometimes never succeed in a 1 minute period.

Is that something to expect? Is this a bug?

MichaelMure avatar Feb 17 '22 17:02 MichaelMure

That's not expected, and might very well be a bug.

Are you still using the old mDNS in parallel? We might have another issue with one of the two implementations that might or might not be related: https://github.com/ipfs/go-ipfs/issues/8695.

In general, mDNS discovery should be fast. Nodes that join the network will query their peers, so they should receive a response very quickly. Have you tried running WireShark to see what's going on on the wire?

marten-seemann avatar Feb 18 '22 08:02 marten-seemann

Are you still using the old mDNS in parallel?

Not in parallel but when I replaced it with mdns_legacy everything worked again.

Have you tried running WireShark to see what's going on on the wire?

No. I can give it a try but I'm familiar at all with what mDNS should looks like.

MichaelMure avatar Feb 18 '22 08:02 MichaelMure

I tried to wireshard a bit. While with the legacy implementation it does show up in wireshark on localhost, the new implementation traffic either doesn't show up or is not recognized properly.

MichaelMure avatar Feb 18 '22 14:02 MichaelMure

2022-04-27 conversation: wireshark-level view is needed here. We're not sure why the new mdns is not showing up for @MichaelMure . This is likely ~.5 day of work to debug. We've downgraded to P2 as there are other peer discovery mechanisms we rely on.

BigLep avatar Apr 27 '22 13:04 BigLep

Assigning myself.

schomatis avatar Jun 13 '22 16:06 schomatis

@MichaelMure Could you share your tests or any small reproduction of your issue, please?

schomatis avatar Jun 20 '22 16:06 schomatis

@marten-seemann I'm blocking this on "need more input from author" as there's little to do without the failing test or something to reproduce the issue with. I have nothing to work on and the other issue is being diagnosed independently.

schomatis avatar Jun 22 '22 15:06 schomatis