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

object.get sometimes returns an empty DAGNode #359

Closed
haadcode opened this issue Jul 8, 2016 · 9 comments
Closed

object.get sometimes returns an empty DAGNode #359

haadcode opened this issue Jul 8, 2016 · 9 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@haadcode
Copy link
Member

haadcode commented Jul 8, 2016

Sometimes, when doing object.get, the result is an empty DAGNode, ie. res.toJSON().Data --> empty buffer). The hash involved is probably this QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n seeing it around a lot.

This has been around since 0.1x.x and is still present in 0.14.1.

@haadcode haadcode added the kind/bug A bug in existing code (including security flaws) label Jul 8, 2016
@haadcode haadcode changed the title object.get sometimes return an empty DAGNode object.get sometimes returns an empty DAGNode Jul 8, 2016
@dignifiedquire
Copy link
Member

This is a bug in js-ipfs-repo. Node streams are not working properly for fs-blob-store when reading and writing a lot.

@dignifiedquire
Copy link
Member

This is an example on how this can be fixed https://gist.github.com/dignifiedquire/b98e2f1caf6c549c0e04895c88e8ca3d

@daviddias
Copy link
Member

@dignifiedquire could you make a diff instead of a gist? (and better, a PR)

@dignifiedquire
Copy link
Member

dignifiedquire commented Aug 1, 2016

@diasdavid no I can not, as this is just a hack. If you look closely it stops using the abstract-blob-store interface and so would immediately stop working in the browser. As far as I can tell this can not be fixed as long as we use abstract-blob-store with node-streams to read and write files.

@daviddias
Copy link
Member

Got it, what I meant was that it is hard to check what changed when there is no diff. Yes, changing from stream to sync write is not the solution.

@haadcode
Copy link
Member Author

haadcode commented Aug 3, 2016

changing from stream to sync write is not the solution

https://gist.github.com/dignifiedquire/b98e2f1caf6c549c0e04895c88e8ca3d#file-datastore-js-L61

I think the problem here was, iirc discussion with @dignifiedquire, that fs.createReadStream in abstract-blob-store was not working as expected. So, his fix was to change the fs layer to use .writeFile (async) instead of streams.

@daviddias
Copy link
Member

This should be fixed once #403 is done

@dignifiedquire
Copy link
Member

#403 was merged and should fix this, please reopen if this is still an issue

@daviddias
Copy link
Member

@haadcode please verify :)

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

No branches or pull requests

3 participants