-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ipfs repo gc
fails with Error: unrecognized object type: %!s(uint64=114)
#3553
Comments
This is probably coming from default:
return nil, fmt.Errorf("has unrecognized object type: %s in %s", c.Type(), c.String()) Ideally GC wouldn't abort just because it fails to read a block. This condition should be a warning at most. |
GC should skip these blocks -- it can't figure out whether they're okay to delete, and what's below it. |
@lgierth with your change:
That "block" is from when I was experimenting with the put API, checking how it reacts to garbage. Definitely a bug |
Thanks for your manual fuzzing, very much appreciated :) |
ohhh cool. @mib-kd743naq can you repro it with a sharness test case? if it's a block you put with the put api I would imagine you should be able to do it with a brand new repo. would be super helpful. thanks for finding this! |
@lgierth this issue is more convoluted than I originally thought. Currently this is how things behave:
But it differs from the original problematic block of Generally this situation can never happen, but in practice it clearly does. The code should be hardened against this somehow... |
@mib-kd743naq thanks for reporting this, we should probably treat unrecognized blocks as 'raw' for all intents and purposes... though ideally we don't get unrecognized blocks in our repos |
I'll look into fixing this. |
If the unrecognized object is pinned indirectly or recursively it might not be safe to continue, as the object could possible contain links that we don't know how to read so we won't be able to figure out what is below it. I apologize if I am mistaken and this situation is impossible. What I can likely do is complete the first stage of the gc (getting the ColoredSet) and collect all pinned objects that can't be read for what ever reason and output a complete list so the user can manually deal with the problem. This might also help with figuring out what is going on with #3453. If on the other hand, the error is happening when trying to delete an unpinned block (or even just iterating over the set of the blocks in the blockstore) then we should continue. Right now it looks like when we can't delete a block we log a debug message and just return without necessary reporting an error. I think I know how to reproduce this bug and will test for both the pinned and unpinned case and make sure we do something sensible` in both case. |
Bumping to 0.4.6, after taking with @whyrusleeping, as the fix is non-trivial. |
Can't this be simplified to just printing a warning and skipping that block? |
If it is not reffed by any other block, it should be? |
This was bumped to the next release. I will have a better idea of where the problem is for this bug once I investigate, which I will likely do in a few weeks. |
While there is no official fix for this yet, I do have an experimental (Aka, works on my machines) program that should resolve these issues: https://github.com/whyrusleeping/repofix I recommend making a backup of your ipfs dir if you can before running that, it shouldnt have any problems, but I always err on the safest side possible when it comes to user data. |
I can work on this. Do we have a clear test case of the problem? |
Okay, since I don't have anything else pressing to do I am going to start to work on this. I will basically work to make the garbage collector as resilient as it is safe to do so, and to report any errors in as clear and helpful manor as possible to make fixing any problems easy. |
@kevina sounds good to me, make sure to do so in small testable changesets :) |
#3712 should help with this, it still needs testing though |
#3712 was merged. It doesnt solve these errors, but it makes them a lot less cryptic and easy to deal with |
Version information:
Type:
Bug
Priority:
P1
Description:
I have maintained the same repository since I started playing with ipfs ~4 months ago. An attempt to clean up the repository currently fails like so:
The last time I used
gc
(and it worked) was about a month ago, I have gone through probably 3 versions from git since.I am not sure how to provide a backtrace/further diag for this, please advise.
The text was updated successfully, but these errors were encountered: