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

Ipns cache is not invalidated #6663

Closed
kpp opened this issue Sep 23, 2019 · 4 comments
Closed

Ipns cache is not invalidated #6663

kpp opened this issue Sep 23, 2019 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@kpp
Copy link
Contributor

kpp commented Sep 23, 2019

Version information:

go-ipfs version: 0.4.22-
Repo version: 7
System version: amd64/linux
Golang version: go1.12.7

Description:

Run 2 nodes on the server and on the client. Add a file on the server and call ipfs name publish --ttl 1h .... Cat that file via /ipns on the server. Add a new file on the server and publish the cid again. The client caches /ipns and the second file is impossible to get via /ipns (cache is not invalidated). The error I got is Error: no link named "file2" under QmUYfCbJoPwifhhrqXzJBXaeScF3MwKXA3sTkCx6BbbmpU. To invalidate the cache I have to restart the daemon which is weird.

@kpp kpp added the kind/bug A bug in existing code (including security flaws) label Sep 23, 2019
@Stebalien
Copy link
Member

This is the point of the TTL:

--ttl string - Time duration this record should be cached for.

It's the same as a DNS TTL.


You may be looking for --lifetime which allows one to specify how long the record should be valid.

@kpp
Copy link
Contributor Author

kpp commented Sep 23, 2019

I completely disagree. If you failed to resolve a path via /ipns/old_path/new_file, then the cache is invalid and ipfs needs to find the actual value in the DHT.
cc @postables

@bonedaddy
Copy link
Contributor

bonedaddy commented Sep 23, 2019

Is the search not checking the DHT and invalidating the cache automatically when this happens? If not it should definitely be doing this.

It seems like the restart fixes the issue because it clears the LRU cache.

If we're going with a cache then it should be proactively managed.

@Stebalien
Copy link
Member

If you need immediate updates, I recommend enabling IPNS over pubsub and setting the TTL to 0 on publish.

Unfortunately, /ipns/old_path/new_file is indistinguishable from /ipns/new_path/nonexistent_file. If we invalidated the cache every time we can't find a file, a tool trying to lookup a bunch of /ipns/QmFoo/*/.well-known-file files in every directory would force us to repeatedly re-query the network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

3 participants