-
Notifications
You must be signed in to change notification settings - Fork 957
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
File-Sharing example silently fails and or panics when trying to send a file too big. #5018
Comments
Hey! The issue might be due to the response limit that is set for cbor in request-response rust-libp2p/protocols/request-response/src/cbor.rs Lines 57 to 58 in c115cdd
Ideally you would want to split the file down into chunks and send it that way to be more efficient (or maybe use something like libp2p-bitswap), but to play around with request-response, you could copy the cbor code above and increase the the response limit to your desire size |
libp2p-bitswap is overkill for such a simple example and will require a lot of other machinery to get working. I don't think the splitting is what we should be thinking about. I think the better alternative is to make this example streaming. _, err := io.Copy(stream, file) |
Correct. We currently don't expose an abstraction that "just" gives you a stream. The current suggestion approach forward to resolve this is: #4457 (which is being worked on actually!). |
I am going to close this as a wont-fix because it is by design that request-response limits the size. Until #4457 is ready, you can always implement your own |
#4457 looks good, I wasn't sure why file-sharing had to use request response, imo it don't need it. But if you write an other example it's fine. |
It doesn't! The main thing this example shows is how to separate the network layer into its own task. See https://github.com/libp2p/rust-libp2p/tree/master/examples/file-sharing#architectural-properties. |
Summary
The file sharing example fails in weird ways with big enough files (I tried with 1GiB).
Similar to #5016
Expected behavior
The file should be streamed without having to hold everything in memory.
Actual behavior
The file is slurped and AFAIT some guards are failing because reading a >1GiB single message is too big.
Relevant log output
Possible Solution
Stream the file.
Version
c115cdd
Would you like to work on fixing this bug ?
No
The text was updated successfully, but these errors were encountered: