Go-ipfs: sharness suite: ipfs name publish: ā€œError: failed to find any peer in tableā€

Created on 4 Nov 2015  Ā·  23Comments  Ā·  Source: ipfs/go-ipfs

ipfs name publish fails with ā€œError: failed to find any peer in tableā€ in the sharness suite when the daemon is running.

(There are no peers intentionally, ipfs bootstrap rm --all is executed in test/sharness/lib/test-lib.sh.)

kinbug topiipns

Most helpful comment

FYI, this is still an issue in 0.4.13 and 0.4.14. In particular, it means if you're running a private swarm with a single node or with intermittent connectivity, ipfs name publish effectively can't be used at all.

All 23 comments

@ion1 this is covered in the test: test_resolve_fail, test_resolve_cmd_fail in https://github.com/ipfs/go-ipfs/blob/master/test/sharness/t0160-resolve.sh.

I think this is caused by https://github.com/ipfs/go-ipfs/commit/7ad8dd85238aeaeafe7c0ca58180cc2e92db7bef, which is intentional?

The comment for test_resolve_fail is:

#todo remove this once the online resolve is fixed

Yes it is meant to be removed.

Maybe there should be ipfs name commit?

I think ipfs name publish should work while the daemon is running without peers just like it does when the daemon is not running. The existing tests (which use test_expect_failure due to this issue) seem to expect that behavior, too.

Either that, or use ipfs name commit for 'daemon off' and 'daemon on but no peer' case (and reserve ipfs name publish when it is possible to publish to peers).
It would be confusing to publish while offline, when there is no pending action/promise to execute when the daemon is on.

related #1593

should probably have a --local flag on this one too.

What do we want the UX to be? I can see cases for:

  • ipfs name publish fails when disconnected. use --local to allow adding a local name, and then propagate it when connected.
  • ipfs name publish works even if disconnected. propagate later. maybe warn user that it's offline, so they get the needed feedback (tricky programmatically). maybe add a --online flag to ensure it's online and fail otherwise.

I don't like the UX of a --online option, I think having the --local option, or just having it work when _offline_

An ā€œis daemon onlineā€ test in the beginning has a race condition. Perhaps the network connection disappears immediately after it.

Perhaps it would be better to make an asynchronous/synchronous distinction.

Default: asynchronous – succeed immediately, best effort to publish the name whenever the daemon is running and online.

Optional: synchronous – fail if the daemon is not running; wait until the record has been added to DHT otherwise.

These issues should be mitigated by using iptb for tests. You should be able to spin up an iptb cluster (as in t0130-multinode.sh) and do ipns publishes just fine

FYI, this is still an issue in 0.4.13 and 0.4.14. In particular, it means if you're running a private swarm with a single node or with intermittent connectivity, ipfs name publish effectively can't be used at all.

I'm getting an error ERROR ipns-repub: Republisher failed to republish: failed to find any peer in table core.go:518

current IPFS version of 0.4.14 any solution for working around?

@vyzo on IRC suggested trying --enable-namesys-pubsub, but no dice:

$ pgrep -laf ipfs
29526 /nix/store/9v5yn8v1sq41753aib3kfqpb6b95v05z-ipfs-0.4.14-bin/bin/ipfs \
          daemon --enable-gc --enable-namesys-pubsub

$ ipfs key list -l | grep testkey
QmavpF6QAS7C6TSHvrGASJVw1hXLD7qphTZ7kR5WjzjAjM testkey

$ ipfs name publish --key=testkey /ipfs/QmTVKRqMywTwwngjTQB8CKycaFQwQHPbd9jdzQv8L9cuqK
Error: failed to find any peer in table

$ ipfs name resolve /ipns/QmavpF6QAS7C6TSHvrGASJVw1hXLD7qphTZ7kR5WjzjAjM
Error: Could not resolve name.

You need to resolve once in the peer first, so that it is subscribed to the topic before the publisher publishes.

There is only one peer involved; it's a single-node swarm. Running ipfs name resolve before ipfs name publish as well as after does not change the behaviour.

I think the issue here is that the rendezvous for ipns pubsub happens through DHT provider records.
If the DHT can't bootstrap because there are no peers to start the DHT, then it will neuter the functionality.

Btw, you need your two peers connected before you publish. If they are not, then the rendezvous for pubsub will fail, and the peer will fail to see the published record.

Per discussion on irc:

It seems that this intentionally a single peer, not connected to anything; so it's a BUG.

So guys, I just want to bump this issue since I am facing it in this moment.
I am trying to setup a private network, I have a single node publishing content to a specific key. When this happens the node could be alone, after this a certain number of peers will start, connect to the peer and eventually try resolving that ipns name.
Everytime the first node tries to publish when is not connected it fails with Error: failed to find any peer in table

I even tried to use the --local option (undocumented in the command help) but it is not helping.

EDIT: I forgot to mention that I am on

# ipfs version
ipfs version 0.4.17

For the record, this is still broken in 0.4.18:

$ ipfs key list -l                                                                                                                                          
QmavpF6QAS7C6TSHvrGASJVw1hXLD7qphTZ7kR5WjzjAjM testkey

$ ipfs name publish --key=testkey QmQn5kVnA9bd2msDdGrxB47yfbxku3hkUoGudu5z6JDpCk                                                            
Error: failed to find any peer in table

$ ipfs name publish --key=testkey --local QmQn5kVnA9bd2msDdGrxB47yfbxku3hkUoGudu5z6JDpCk                                                            
Error: failed to find any peer in table

$ ipfs name publish --key=testkey --allow-offline QmQn5kVnA9bd2msDdGrxB47yfbxku3hkUoGudu5z6JDpCk                                                            
Error: failed to find any peer in table

$ ipfs name resolve /ipns/QmavpF6QAS7C6TSHvrGASJVw1hXLD7qphTZ7kR5WjzjAjM
[hangs for a really long time, then]
Error: could not resolve name

The documentation for --allow-offline implies it should do exactly what I want:

  --allow-offline           bool   - When offline, save the IPNS record to the the local datastore without
                                     broadcasting to the network instead of simply failing.                                                                                                                                                        

I'm not sure if this is a matter of me not understanding the documentation, the documentation being wrong, or a bug preventing --allow-offline from actually working. Perhaps it only applies if node was started with --offline, and not if the node is in "online mode" but not actually connected to anything?

For the record, this is still broken in 0.4.18:

--allow-offline was added to allow publishing while running in offline mode (or in combination with the new --offline flag. However, it _should_ probably work in this case as well. That is, it should allow publishing to succeed even if the actual _publish_ step fails.

After some testing, it does in fact work in --offline mode (which I previously wasn't using because of #4389 but now have a workaround for). So that's good enough for my purposes. I agree that it should work in "online but not actually connected to anything" mode, though -- even if it can't broadcast the new IPNS entry you should still be able to look it up locally.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magik6k picture magik6k  Ā·  3Comments

whyrusleeping picture whyrusleeping  Ā·  4Comments

daviddias picture daviddias  Ā·  3Comments

zignig picture zignig  Ā·  3Comments

funkyfuture picture funkyfuture  Ā·  3Comments