n0-computer / beetle

Other
34 stars 15 forks source link

Another add/get roundtrip bug #116

Closed rklaehn closed 1 year ago

rklaehn commented 1 year ago

When trying out https://github.com/n0-computer/iroh/pull/411 @b5 found a weird issue. I investigated this and found something. Turns out it is also on main, unfortunately...

Created a random 300mb file and added it, then tried to get it again. Result see below.

image
rklaehn commented 1 year ago

So when you ask to store an file with more than one block, it tries to make a file for each block...

Dir 
Reader test500k
Reader test500k/bafkreiheftkwfbozallza3tporwludxwcbiyu3fdfbptszi2o3y4efjhjq
Reader test500k/bafkreia7v4spb7aujvginzyfon2jjkngszdopxghga6e56l2bfhe7jxsp4
b5 commented 1 year ago

script to trigger the get hang. may need to run a few times to reproduce:

#!/bin/bash
head -c 100000000 /dev/urandom > random100m
HASH=`cargo run -p iroh -- add --no-wrap random100m | tail -n 1`
cargo run -p iroh -- get $HASH
HASH=${HASH:6}
shasum random100m
shasum $HASH
b5 commented 1 year ago

Very real reason to believe the problem is with content iroh is creating. We should run to ground if this can happen with externally created data.

We're also seeing strange output in filenames added with iroh:

Screen_Shot_2022-10-25_at_18 04 18
ramfox commented 1 year ago

So fun fun! The above example is a HAMT!

Looks like the issue is not new, we just haven't investigated hamts much on the command line. The gateway displays the names correctly:

Screen Shot 2022-10-25 at 14 03 20

On investigation, the links inside of our hamt::Node have these weird char prefixes in their names, so my best first guess is this probably has something to do with how we encoding the string names into the links.

Arqu commented 1 year ago

Spaces etc might get url encoded. Eg / is %2F which then might be stripped of illegal chars and turning into 2F etc.

ramfox commented 1 year ago

closed by n0-computer/iroh#422