-
Notifications
You must be signed in to change notification settings - Fork 1.3k
intermitent ERR_PUTTING_TO_ROUTING on IPFS.name.publish #4267
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
I want to add that I couldn't get the github fork to work on npm, nor could I build it through lerna. So all I have left is to do the monkeypatch directly in the node_modules folder, which solves the problem on the server but does not solve the problem in the bundle that goes to the web user. It's still a problem.
|
I also want to add that this message must be the same bug in the .put in the libp2p DHT, because each timeout will insert an abort event and overflow the normal limit of the node. after all, there are almost 300 connections going on, dozens of timeouts can occur at all times.
|
Was running into this too and ended up switching to Kubo with ipfs-http-client (which introduced another set of bugs 😛 |
js-IPFS is in the process of being deprecated, the replacement is Helia - please see the State of IPFS in JS post for a bit of background and the migration guide for how to port your app over. When running a network query to publish IPNS records, a number of sub-queries are run to find KAD-close peers - individual sub-queries can fail with a timeout or other error without the whole query being aborted, but if they all fail then the whole query will fail. Unfortunately the set of peers you will query depends on the KAD-ID of the key you are trying to publish so it's very hard to replicate in a deterministic manner. What will happen though, is that some peers will be harder to dial than others as they might be publishing private (e.g. un-dialable) addresses or they might not support the right set of network transports. Helia ships with the latest transports and will be where fixes are deployed from now on so please can you upgrade your app and see if the problem persists? |
the problem
This is an exception that happens practically all the time when trying to publish on IPNS and it makes the use of IPNS unfeasible if there is no reasonable solution.
the debug
I debugged the source within the limits of my time, and I found the source of the problem, which is this line where a .put is made in the DHTDataStore that forwards the .put to all peers in the libp2p DHT.
js-ipfs/packages/ipfs-core/src/ipns/routing/dht-datastore.js
Line 27 in 6be5906
What happens is that almost always there will be one or another peer that gives TIMEOUT, and this will trigger an EXCEPTION, which is propagated without any treatment to the upper layer that generalizes the error as ERR_DB_WRITE_FAILED on Errors.dbWriteFailedError, and the error is generalized again on another higher layer as ERR_PUTTING_TO_ROUTING
https://github.com/ipfs/js-datastore-core/blob/6851f672c3c60b5fff8131a7c450164aef50ffe9/src/tiered.js#L58
Below is my crazy monkey style debug code (I don't have time, I need this working now)
I tried to identify if the error happened in a specific item of the 'drain', but that's not how it happens, the exception appears at the end, before the last item (I suppose it's the last one, I can't guarantee that)
other potential implications
I believe this same bug also introduces a memory leak, a big one, but that's just a guess from my experience with js.
other 'issues' presenting the same problem
I will list here two other issues that have presented the same problem, where the palliative solution found by the users was a loop of attempts or restarting the node, where for a few moments all the peers are newly connected and do not have a high TIMEOUT chance. In this second case I tested and could confirm that the DHT is not connected to any peer and therefore the publish will not do anything, not even a timeout, so it is not a solution.
#4202
#4023
the solution
I made a fork and introduced these modifications. It's not an elegant solution, but it does the trick and I'll be able to get my app live later today.
algorista@0ee74f2
I believe that the elegant solution would be to properly handle the AbortEvent in layers closest to libp2p and ensure that at least some peers replicated the ipns, and only if none were reached, then send a throw. I also think there's room for more parallelization in that .put. With a little time I will study this calmly.
final considerations
If anyone arrives here like I did, looking for an urgent solution, you might consider temporarily installing from my fork, or monkeypatch from there.
npm install 'https://github.com/algorista/js-ipfs.git#algorista'
The text was updated successfully, but these errors were encountered: