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

crash when dropping a big file #464

Closed
2 tasks done
Fil opened this issue Apr 18, 2018 · 3 comments · Fixed by #596
Closed
2 tasks done

crash when dropping a big file #464

Fil opened this issue Apr 18, 2018 · 3 comments · Fixed by #596
Assignees
Labels
help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) status/blocked/upstream-bug Blocked by upstream bugs status/in-progress In progress

Comments

@Fil
Copy link

Fil commented Apr 18, 2018

dropping a big file (4GB) on the quick upload feature results in a crash


Clarifying tasks added by @lidel:

  • dont crash when dropping >128MB in Chrome
  • don't break silently in Firefox when Buffer max size is breached
@lidel lidel added status/blocked/upstream-bug Blocked by upstream bugs kind/bug A bug in existing code (including security flaws) UX labels Apr 18, 2018
@lidel
Copy link
Member

lidel commented Apr 18, 2018

Thank you for reporting this.
I was able to reproduce the problem and it looks bit different depending on which browser is used.

Background

Currently entire file is buffered in memory before being sent to external daemon, which introduces artificial limit on the max upload size.

Current Upload Size Limits

Chrome

This one looks really bad. An upload to an external node over js-ipfs-api breaks between 96MB and 128MB in size. It just kills my Chromium build:

screenshot_8

Crashing Chrome is a known upstream bug, tracked in ipfs-inactive/js-ipfs-http-client#654

Firefox

Firefox works fine with 1GB file, but things bigger than 2GB hit language/lib limitations and fail silently with:

RangeError: Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes

This is something we should at least provide proper error handling for.

Possible Workarounds

While waiting for upstream fixes, we can do some work to address these problems:

  • UX: detect uploads bigger than a limit of a current runtime and display feedback for the user instead of failing/crashing
  • Investigate streaming versions of ipfs.add

@lidel lidel added the help wanted Seeking public contribution on this issue label Apr 18, 2018
lidel added a commit that referenced this issue May 23, 2018
@lidel
Copy link
Member

lidel commented May 23, 2018

I partially addressed this in #483.

Streaming only helps if embedded js-ipfs node is used.
When external node is used js-ipfs-api seems to buffer entire thing in memory which causes the crash (even when streaming API is used). For that case we just refuse uploads over limit until the issue is fixed upstream (ipfs-inactive/js-ipfs-http-client#654).

I was unable to address Firefox error under 2GB as I am working on low-memory laptop, will look at it next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) status/blocked/upstream-bug Blocked by upstream bugs status/in-progress In progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants