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

pin add hangs on a particular cbor object #3650

Closed
ianopolous opened this issue Feb 3, 2017 · 3 comments
Closed

pin add hangs on a particular cbor object #3650

ianopolous opened this issue Feb 3, 2017 · 3 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@ianopolous
Copy link
Member

Version information:

go-ipfs version: 0.4.5-rc1-313b884
Repo version: 5
System version: amd64/linux
Golang version: go1.7.1

Type: Bug

Priority: P0

Description:

pin add hangs. A minimal repro is:

printf "\x4b\x67\x27\x64\x61\x79\x20\x49\x50\x46\x53\x21" | ipfs block put --format=cbor
=> zdpuAsFzbmVjkDjySRJNAw2ndtAogPUVqCSZgP4MhxVRxVcE4
printf "\xa2\x65\x61\x6c\x69\x6e\x6b\xd8\x2a\x58\x25\x00\x01\x71\x12\x20\x65\x96\x50\xfc\x34\x43\xc9\x16\x42\x80\x48\xef\xc5\xba\x45\x58\xdc\x86\x35\x94\x98\x0a\x59\xf5\xcb\x3c\x4d\x84\x86\x7e\x6d\x31\x63\x61\x72\x72\x80" | ipfs block put --format=cbor
=> zdpuAq6Q29ycu5frDQ9kkUf2HHhNWNgCQtyUZUWZBP1423vvn
ipfs pin add -r zdpuAq6Q29ycu5frDQ9kkUf2HHhNWNgCQtyUZUWZBP1423vvn

The pin hangs.
The first object is just a cbor byte[] of "g'day IPFS!"
The second is a cbor map with 2 elements, a merkle link, and an empty cbor list:
{
"alink":"zdpuAsFzbmVjkDjySRJNAw2ndtAogPUVqCSZgP4MhxVRxVcE4",
"arr:[]
}

ipfs dag get on the second object gives:
{"alink":"zdpuAsFzbmVjkDjySRJNAw2ndtAogPUVqCSZgP4MhxVRxVcE4","arr":null}
Not sure why the empty list has become null..

@ianopolous
Copy link
Member Author

ianopolous commented Feb 3, 2017

I forgot to add that removing either of the elements in the map makes the pin succeed. E.g. removing the cbor list

# same first command, then
printf "\xa1\x65\x61\x6c\x69\x6e\x6b\xd8\x2a\x58\x25\x00\x01\x71\x12\x20\x65\x96\x50\xfc\x34\x43\xc9\x16\x42\x80\x48\xef\xc5\xba\x45\x58\xdc\x86\x35\x94\x98\x0a\x59\xf5\xcb\x3c\x4d\x84\x86\x7e\x6d\x31" | ipfs block put --format=cbor
=> zdpuAnhb9rC4Mw8G1QcsJK7TJB6QW6d1JR5VUWcUU16muTbdf
ipfs pin add -r zdpuAnhb9rC4Mw8G1QcsJK7TJB6QW6d1JR5VUWcUU16muTbdf

@whyrusleeping whyrusleeping added the kind/bug A bug in existing code (including security flaws) label Feb 4, 2017
@ianopolous
Copy link
Member Author

After #3666 this is still the same except the conversion from [] to null in dag get is fixed.

@ianopolous
Copy link
Member Author

This is fixed by ensuring our map keys are ordered by cbor canonical order (which is NOT lexicographic order - shorter keys are first)

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

2 participants