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

Bug in hashing process crashes retrieve process #1175

Closed
Eknir opened this issue Jan 28, 2021 · 0 comments
Closed

Bug in hashing process crashes retrieve process #1175

Eknir opened this issue Jan 28, 2021 · 0 comments
Assignees
Labels
bug Something isn't working issue

Comments

@Eknir
Copy link
Contributor

Eknir commented Jan 28, 2021

Summary

When we upload files of with 16519168 < size < 16773119, (with encryption) or 67100000 without encryption, a hash is generated but there are unretrievable
These size generate a Data length of 0 in the metadata, crashing the retrieve process

Steps to reproduce

truncate -s 16154k bee.jpg
curl -F file=@bee.jpg -H "Swarm-Encrypt: true" http://localhost:1633/files
  1. Download using the hash generated

The size of problematic files can be calculated on how levels are filled

Expected behavior

Actual behavior

Extra

  • Related: Files from specific sizes instantly disappear after encryption swarm#2211
  • suspected cause: According to our research, the problem comes from the function "hoistLevels" in hastrie.go, when the target level in the merkle tree is empty after a recursive wrap.
  • fix: A proposed quick fix is to launch this function again with the upper level
    adding this at line 138 :
if tlen == 0 {
 return h.hoistLevels(level + 1) 
}
@Eknir Eknir added the bug Something isn't working label Jan 28, 2021
@bee-runner bee-runner bot added the issue label Jan 28, 2021
@acud acud self-assigned this Feb 15, 2021
@Eknir Eknir closed this as completed Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working issue
Projects
None yet
Development

No branches or pull requests

2 participants