js-libp2p: EADDRNOTAVAIL and crash
Versions:
"libp2p": "^0.30.0",
"libp2p-bootstrap": "^0.12.1",
"libp2p-gossipsub": "^0.8.0",
"libp2p-kad-dht": "^0.20.4",
"libp2p-mdns": "^0.15.0",
"libp2p-mplex": "^0.10.1",
"libp2p-noise": "^2.0.1",
"libp2p-secio": "^0.13.1",
"libp2p-tcp": "^0.15.1",
"libp2p-webrtc-star": "^0.20.5",
"libp2p-websockets": "^0.15.0",
Type: bug
Severity: Critical
Description:
We are using libp2p and gossipsub to create a messaging channel for our application. We have tested it locally and everything worked ok, now we have deployed it and have big problem where our backends crashes rather randomly without much information, but I am pretty sure it is libp2p related.
The error is:
rif-pubsub-bootnode-02 | Error: connect EADDRNOTAVAIL 2604:a880:800:a1::1738:a001:4002 - Local (:::0)
rif-pubsub-bootnode-02 | at internalConnect (net.js:882:16)
rif-pubsub-bootnode-02 | at defaultTriggerAsyncIdScope (internal/async_hooks.js:294:19)
rif-pubsub-bootnode-02 | at defaultTriggerAsyncIdScope (net.js:972:9)
rif-pubsub-bootnode-02 | at process._tickCallback (internal/process/next_tick.js:61:11)
rif-pubsub-bootnode-02 | Emitted 'error' event at:
rif-pubsub-bootnode-02 | at emitErrorNT (internal/streams/destroy.js:91:8)
rif-pubsub-bootnode-02 | at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
rif-pubsub-bootnode-02 | at process._tickCallback (internal/process/next_tick.js:63:19)
rif-pubsub-bootnode-02 exited with code 1
Steps to reproduce the error:
To be honest, I have no idea how to reproduce this 😦
Would you have any pointers on what is happening and how to handle this?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (13 by maintainers)
Ok, keep me posted with the logs. After failing I think you should try to setup the
announceFIlter. It does not fix the underlying issue but should mitigate this problem while we look into this deeperThanks a lot! Will try.
Btw. there was error on our side and the log produced was indeed from 0.29.0. But the other components should run the 0.30.0 and still crushing.
Thanks for all the detailed information. So, from my initial diagnosis, the flow to the error is:
QmaGV9yF1F8QMucmf4zUSXUWqU1ANvKxEENsLYuCHA6Dt3QmPEr3yxLMg37sg7yM39qfDMgo18BjpXcwtcgqcChFVbNMQmPEr3yxLMg37sg7yM39qfDMgo18BjpXcwtcgqcChFVbNMsocket.ioconnect for getting the raw connection and we are not listening for itA question to validate this:
p-anynot caring about the order 🤔A piece of feedback regarding this setup. If your setup relies on a public network, which seems to be, I really recommend you to use the new customAnnounce address filter in production. This filter function allows you to filter announced addresses programatically.
The nice thing here is that other nodes would not attempt to dial private address like:
The node would only advertise its reachable (public) addresses, improving the dial performance of the network. You can look into https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#customizing-libp2p (search for
announceFilterand use thelibp2p-utilsfilter to filter out private addresses. Bear in mind that you will probably want this only in production and not in a local test environment.@jacobheun we should look into thinking on a design to improve the dialer logic a bit. Thinking about the 2 following points:
Okey, now back with a crash. I’m pasting the whole last minute before it happened, as idk how much is needed. Lemme know if it’s enough or if I should go further back.
Hmm to clarify the information that my colleagues already put up. The config that Lucas put is the extension config of our base config. For the base config see bellow. It is worth noting that this one is for our boot node, so we don’t use bootstrap here, but in our other components, we do. Also even though we have listening addresses bound only to localhost, it runs in Docker container so Docker translates the requests as coming from localhost.
We had this problem prior to upgrading to
0.30.0and upgraded afterward to see if the problem would be fixed.Just an idea, could it be a problem that we do not actually listen on IPv6 address? And some peer wants to connect to it?
The base libp2p config that we use is:
We set the
DEBUG=libp2p*and we’ll reach you back as soon it crashes again. As for the config, we’re loading it aswith the following (JSON5) config piece: