Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

File added right after 'ready' event doesn't get announced to DHT #1526

Closed
jhiesey opened this issue Aug 23, 2018 · 1 comment
Closed

File added right after 'ready' event doesn't get announced to DHT #1526

jhiesey opened this issue Aug 23, 2018 · 1 comment
Assignees
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) kind/wontfix-migration-available status/deferred Conscious decision to pause or backlog

Comments

@jhiesey
Copy link

jhiesey commented Aug 23, 2018

  • Version: 0.31.7
  • Platform: Darwin Johns-MacBook-Pro-4.local 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul 6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64
  • Subsystem: libp2p (maybe)

Type: Bug

Severity: Medium

Description:

When I enable the DHT and disable prefetch in the ipfs-101 example, the added file is not advertised through the DHT and is thus not visible to other nodes. This is happening because dht.provide() is called before any peers are available, so the call to dht.getClosestPeers() fails. The following appears in the logs:

  libp2p:dht:QmeKMaZs getClosestPeers to  �|?�Q��Q��0��ܠ����o��Ϥ�Xf� +3ms
  libp2p:dht:query: �|?�Q��Q��0��ܠ����o��Ϥ�Xf�:QmeKMaZs:error Running query with no peers +0ms

Adding a few seconds of delay before calling node.files.add() fixes the issue.

I'm not sure where this should be fixed (even ipfs vs libp2p), but the DHT shouldn't be used before it's ready to accept queries.

Steps to reproduce the error:

  1. Clone modified example at https://github.com/jhiesey/js-ipfs/blob/dht-test/examples/ipfs-101/1.js
  2. Edit string on line 31 to be unique
  3. Run DEBUG="libp2p:dht*" node 1.js
  4. Note error in console about dht query with no peers
  5. Try ipfs cat /ipfs/<hash> on another node. It hangs forever.
@daviddias daviddias added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked labels Aug 25, 2018
@hugomrdias hugomrdias added status/deferred Conscious decision to pause or backlog and removed status/ready Ready to be worked P1 High: Likely tackled by core team if no one steps up labels May 21, 2020
@SgtPooki SgtPooki self-assigned this May 17, 2023
@SgtPooki SgtPooki moved this to 🥞 Todo in js-ipfs deprecation May 17, 2023
@SgtPooki
Copy link
Member

js-ipfs is being deprecated in favor of Helia. You can learn more about this deprecation and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see #4336).

This issue is most likely resolved in Helia, please try it out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) kind/wontfix-migration-available status/deferred Conscious decision to pause or backlog
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants