Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangs while fetching an non existing hash #5537

Closed
rohitkhatri opened this issue Sep 28, 2018 · 6 comments
Closed

Hangs while fetching an non existing hash #5537

rohitkhatri opened this issue Sep 28, 2018 · 6 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@rohitkhatri
Copy link

rohitkhatri commented Sep 28, 2018

When I try to fetch any non existing hash with ipfs get command like the below:

ipfs get QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa

It just hangs.

I'm using private network using own swarm key.

Here's how I have setup my network:

ipfs init
ipfs bootstrap rm --all
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8091
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs-swarm-key-gen > ~/.ipfs/swarm.key
export BOOTSTRAP_PEER_ID=$(ipfs id -f="<id>")
ipfs bootstrap add /ip4/127.0.0.1/tcp/4001/ipfs/${BOOTSTRAP_PEER_ID}
export LIBP2P_FORCE_PNET=1 && ipfs daemon

Version information: 0.4.17

Type: Bug

Description: Hangs while fetching an non existing hash

@magik6k
Copy link
Member

magik6k commented Sep 28, 2018

It's not really possible to know that a chunk of data doesn't exist on the network, so ipfs just keeps looking for it indefinitely.

For a workaround, there is a --timeout flag on all commands, so you can specify that for example get should fail after some amount of time:

ipfs get QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa --timeout=60s

@rohitkhatri
Copy link
Author

rohitkhatri commented Sep 28, 2018

@magik6k Thanks for replying, and what If the file is longer and takes time to download, will that work with timeout option?

@magik6k
Copy link
Member

magik6k commented Sep 28, 2018

No, timeout applies since command start. I don't think there is any built-in way to do that, but you can try creating a utility which tracks get output and aborts it if it takes too long to process some item.

This could be implemented as --read-timeout flag on ipfs get command quite easily

@magik6k magik6k added the help wanted Seeking public contribution on this issue label Sep 28, 2018
@eingenito
Copy link
Contributor

eingenito commented Sep 28, 2018

There is another command you can run to look up content in the DHT (as a distinct step from fetching the content): ipfs dht findprovs -n 1 <hash> --timeout=60s.

If that command fails to return a hash of a peer record (which are subsequently used to lookup and actually connect to providing peers), you've failed to find any mention of the content in the DHT. If it does successfully return a hash of a provider then you know that at some point at least one peer advertised themselves as providing the content. And that your get is probably failing further along the process.

@Stebalien
Copy link
Member

Stebalien commented Sep 28, 2018

@magik6k can you file that suggestion as a new issue (trying to see if we can replace "I have a problem" issues with "Implement feature X" issues to make the issue tracker easier to track).

@magik6k magik6k removed the help wanted Seeking public contribution on this issue label Sep 28, 2018
@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Sep 28, 2018
@Stebalien
Copy link
Member

Stebalien commented Sep 28, 2018

Closing for tracking in favor of #5541. @rohitkhatri feel free to ask followups (or ask for this to be reopened).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants