libp2p / go-libp2p-kad-dht

A Kademlia DHT implementation on go-libp2p
https://github.com/libp2p/specs/tree/master/kad-dht
MIT License
521 stars 223 forks source link

chat-with-rendezvous example is broken since v0.24.0 #963

Closed aep closed 3 months ago

aep commented 7 months ago

this example https://github.com/libp2p/go-libp2p/tree/master/examples/chat-with-rendezvous

discovery.FindPeers(ctx, routingDiscovery, rendezvous) doesnt return any peers other than the bootstrap server

i bisected the problem to this repo, commit d373974d31867207c5ce3b471f1d8c0fb5f14e05

guillaumemichel commented 7 months ago

The chat example works for me, but it triggers many warnings (Connection failed:failed to dial: failed to dial 12D3KooWBLdz8BdrX1BP18k7EMFeDRi7tu7ujynVeowHRQNd739B: no good addresses). I don't know if it was already the case before.

What issues are you exactly experiencing?

emiamar commented 5 months ago

I am also facing issue with this example , Need help. There doc for helping setup rendezvous server ourself, I tried printing the bootstrap node, they all are down.


2024-04-18T23:17:48.499+0530    WARN    rendezvous  chat-with-rendezvous/chat.go:140    bootstrap ourselves...
2024-04-18T23:17:48.499+0530    INFO    rendezvous  chat-with-rendezvous/chat.go:141    /dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN,/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa,/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb,/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt,/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
2024/04/18 23:17:48 websocket: failed to close network connection: close tcp 192.168.1.5:59420->145.40.118.135:443: use of closed network connection
2024/04/18 23:17:48 websocket: failed to close network connection: close tcp [2401:4900:1cbd:3047:8dc8:6ddd:e184:14ee]:59422->[2604:1380:40e1:9c00::1]:443: use of closed network connection
2024/04/18 23:17:51 websocket: failed to close network connection: close tcp [2401:4900:1cbd:3047:8dc8:6ddd:e184:14ee]:59424->[2604:1380:45e3:6e00::1]:443: use of closed network connection
2024/04/18 23:17:51 websocket: failed to close network connection: close tcp 192.168.1.5:59425->139.178.91.71:443: use of closed network connection
2024-04-18T23:17:53.072+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWCWPzmFKERssN6KbMp4j6ityEhR6eu1w3fLHnH3qrmfzZ: Application error 0x1 (remote): conn-52503413: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:17:53.459+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWCWPzmFKERssN6KbMp4j6ityEhR6eu1w3fLHnH3qrmfzZ: Application error 0x1 (remote): conn-52503427: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:04.231+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWLdXZtpSxcxvWA8bFCrwQtyrTuuBBNjVDWiLa5g8BD1od: Application error 0x1 (remote): conn-182384297: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:11.123+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWFqpqwQGCD3ABFuMZWV7ztm6E9tBbCAVp1j2Py2ftg2to: Application error 0x1 (remote): conn-43365039: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:11.472+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWFqpqwQGCD3ABFuMZWV7ztm6E9tBbCAVp1j2Py2ftg2to: Application error 0x1 (remote): conn-43365042: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:18.701+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWGC4s6QnfW7Smw1vMfrKPAddpLHbWBTZYEijXSs3Jg8WK: Application error 0x1 (remote): conn-7636102: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:19.162+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWGC4s6QnfW7Smw1vMfrKPAddpLHbWBTZYEijXSs3Jg8WK: Application error 0x1 (remote): conn-7636106: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:19.640+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWMYftqrFRyGaZoHnNQdr5jxdD7jZxpU65MRion77zvtgu: Application error 0x1 (remote): conn-6463131: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:19.790+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWMYftqrFRyGaZoHnNQdr5jxdD7jZxpU65MRion77zvtgu: Application error 0x1 (remote): conn-6463208: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:20.007+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWPqdSsDHZ8PRM35MsuCKm9RFpmheG3Gc93wb4TKE79YEZ: Application error 0x1 (remote): conn-9417850: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:20.846+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWDcKMQ98n7cbccAjnWvLjWMBqDvnCxWSzkcVGMG29RnQM: Application error 0x1 (remote): queue full
2024-04-18T23:18:28.071+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWG7MnUPboUPKijPreSFGUdhFmvGmgzjsfT9XB1dxpegxB: Application error 0x1 (remote): conn-41270239: system: cannot reserve inbound connection: resource limit exceeded
2024-04-18T23:18:28.542+0530    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWG7MnUPboUPKijPreSFGUdhFmvGmgzjsfT9XB1dxpegxB: Application error 0x1 (remote): conn-41270242: system: cannot reserve inbound connection: resource limit exceeded ```
guillaumemichel commented 5 months ago

What transport are you using? Not all bootstrappers support websocket.

bootstrappers

TCP and QUIC have better availabilities.

emiamar commented 5 months ago

@guillaumemichel can you help me to achieve it? Is there any example/sample code that I can follow? Even routed-echo example is not working.

guillaumemichel commented 5 months ago

@emiamar Could you provide more information? What exactly is failing?

MarcoPolo commented 5 months ago

I wasn't able to repro this issue either. I made some changes in https://github.com/libp2p/go-libp2p/pull/2769, can you try again with that new code?

emiamar commented 5 months ago

@guillaumemichel / @MarcoPolo I m trying to run an example https://github.com/libp2p/go-libp2p/tree/master/examples/chat-with-rendezvous

Even when I pulled the lates code from MarcoPolo

When I try , I am getting below warning , even when I run this on publicly routable servers. Can you point me if m missing something here

ubuntu@ubuntu:~/go-libp2p/examples/chat-with-rendezvous$ go build -o chat
ubuntu@ubuntu:~/go-libp2p/examples/chat-with-rendezvous$ ./chat -listen /ip4/127.0.0.1/tcp/6666
2024-04-27T19:03:52.230Z    WARN    p2p-config  config/config.go:304    rcmgr limit conflicts with connmgr limit: conn manager high watermark limit: 192, exceeds the system connection limit of: 156
2024-04-27T19:03:52.246Z    INFO    rendezvous  chat-with-rendezvous/chat.go:105    Host created. We are:12D3KooWN2UP6xsRWgRFEVP9bTjdFY7FMX6ntBxFU6FsBQJr8cAs
2024-04-27T19:03:52.246Z    INFO    rendezvous  chat-with-rendezvous/chat.go:106    [/ip4/127.0.0.1/tcp/6666]
2024-04-27T19:03:52.247Z    WARN    dht/RtRefreshManager    rtrefresh/rt_refresh_manager.go:187 failed when refreshing routing table2 errors occurred:
    * failed to query for self, err=failed to find any peer in table
    * failed to refresh cpl=0, err=failed to find any peer in table

2024-04-27T19:03:52.249Z    WARN    dht/RtRefreshManager    rtrefresh/rt_refresh_manager.go:233 failed when refreshing routing table    {"error": "2 errors occurred:\n\t* failed to query for self, err=failed to find any peer in table\n\t* failed to refresh cpl=0, err=failed to find any peer in table\n\n"}
2024-04-27T19:03:53.247Z    INFO    rendezvous  chat-with-rendezvous/chat.go:139    Announcing ourselves...
2024/04/27 19:03:53 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.

2024-04-27T19:04:15.647Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWSchyAoYMkuJswuRRGmG68JKASU34TsNUe5MN1ePjQnCp: Application error 0x1 (remote): conn-48870766: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:23.130Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWED5LDCopEDt5P6wHD3Cdrc8RbxNLBjgNwmwcUZvnwLbr: Application error 0x1 (remote): conn-32146476: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:23.205Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWQ1ePNxEQVro2KrVA6J5YkizhqgUrz9wFsZpA7qXBJoVk: Application error 0x1 (remote): conn-4605670: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:23.769Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWQ1ePNxEQVro2KrVA6J5YkizhqgUrz9wFsZpA7qXBJoVk: Application error 0x1 (remote): conn-4605680: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:23.902Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWED5LDCopEDt5P6wHD3Cdrc8RbxNLBjgNwmwcUZvnwLbr: Application error 0x1 (remote): conn-32146495: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:46.533Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWLdXZtpSxcxvWA8bFCrwQtyrTuuBBNjVDWiLa5g8BD1od: Application error 0x1 (remote): conn-189697148: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:47.049Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWLdXZtpSxcxvWA8bFCrwQtyrTuuBBNjVDWiLa5g8BD1od: Application error 0x1 (remote): conn-189697151: system: cannot reserve inbound connection: resource limit exceeded
2024/04/27 19:04:48 websocket: failed to close network connection: close tcp [2401:4900:1cbd:8d21:2865:3f26:1343:3b3]:40454->[2604:1380:4602:5c00::1]:443: use of closed network connection
2024-04-27T19:04:56.569Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWPhnNwFmCgxYES2hgKARSHZpUhXXzix2S3Ev3nLhZ2pJB: Application error 0x1 (remote): conn-3363851: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:04:56.779Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWLoTNH8KNduHJVtjXChCf9NCHqsGprm1K8szUoRcz8rpQ: Application error 0x1 (remote): conn-3804713: system: cannot reserve inbound connection: resource limit exceeded
 2024-04-27T19:05:55.378Z   WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWRAchpsWrf4wwpRH7xHgB3HFgWFxz8xc8PcPfMbNJXrj3: Application error 0x1 (remote): conn-77049297: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:05:55.509Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWQ86URB6cLrqHJ2DhYUSYJVgak9E96WRVbUQiWh6s677S: Application error 0x1 (remote): conn-51691103: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:05:56.890Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWH4ixF1M3ftRiemu4FBDJbDKYqLc12QKA7VCGcsXFx6WJ: Application error 0x1 (remote): conn-2224032: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:05:57.159Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWH4ixF1M3ftRiemu4FBDJbDKYqLc12QKA7VCGcsXFx6WJ: Application error 0x1 (remote): conn-2224035: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:05:58.378Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWH8mxc5taKSSWohx1r1AqwX6nCfV2Tpjp2GVWYvgU4EgA: Application error 0x1 (remote): conn-84093267: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:06:02.279Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWRAchpsWrf4wwpRH7xHgB3HFgWFxz8xc8PcPfMbNJXrj3: Application error 0x1 (remote): conn-77049387: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:06:02.410Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWQ86URB6cLrqHJ2DhYUSYJVgak9E96WRVbUQiWh6s677S: Application error 0x1 (remote): conn-51691187: system: cannot reserve inbound connection: resource limit exceeded
2024-04-27T19:06:09.596Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWR8KVrGdAfUUWCkp5wwHfJkKwdx3ZQwcu5es87gEDXhw7: Application error 0x1 (remote): queue full
guillaumemichel commented 5 months ago

@emiamar You need to run ./chat -listen /ip4/127.0.0.1/tcp/6666 and ./chat -listen /ip4/127.0.0.1/tcp/6668 in two terminal sessions concurrently so that the connection can be opened between the 2 nodes.

You can also try providing a -rendezvous <customString> parameter, so that your 2 nodes will only try to connect to each other. Note that if you run the same example many times, the provider records remain in the DHT, so the nodes will try to connect to the peer ids that were also advertised previously.

the warnings you pasted don't prevent the example from working.

2024-04-27T19:03:52.247Z    WARN    dht/RtRefreshManager    rtrefresh/rt_refresh_manager.go:187 failed when refreshing routing table2 errors occurred:
    * failed to query for self, err=failed to find any peer in table
    * failed to refresh cpl=0, err=failed to find any peer in table

2024-04-27T19:03:52.249Z    WARN    dht/RtRefreshManager    rtrefresh/rt_refresh_manager.go:233 failed when refreshing routing table    {"error": "2 errors occurred:\n\t* failed to query for self, err=failed to find any peer in table\n\t* failed to refresh cpl=0, err=failed to find any peer in table\n\n"}

The routing table is empty when starting, and no connection was established so far. So the peer is unable to refresh the routing table. That is totally normal.

2024-04-27T19:03:52.230Z    WARN    p2p-config  config/config.go:304    rcmgr limit conflicts with connmgr limit: conn manager high watermark limit: 192, exceeds the system connection limit of: 156
2024/04/27 19:03:53 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.
2024-04-27T19:04:15.647Z    WARN    net/identify    identify/id.go:399  failed to identify 12D3KooWSchyAoYMkuJswuRRGmG68JKASU34TsNUe5MN1ePjQnCp: Application error 0x1 (remote): conn-48870766: system: cannot reserve inbound connection: resource limit exceeded

This is certainly due to a misconfiguration of the resource manager or UDP Buffer Size (see link).

github-actions[bot] commented 4 months ago

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] commented 3 months ago

This issue was closed because it is missing author input.