Track tasks and feature requests
Join 40 million developers who use GitHub issues to help identify, assign, and keep track of the features and bug fixes your projects need.
Sign up for free See pricing for teams and enterprisesCommon error: Array buffer allocation failed #895
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I think I know why this is happening. This is because we're packing the Windows app as a 32-bit app, where we run out of address space after only 4GB of memory use. Maybe we can also fail to allocate a buffer before then if there isn't a big enough block of continuous memory available. I just grepped all past logs. We've seen 303 distinct sessions that have this error and they're all on Windows, with Ideas for how to fix this in
|
This comment has been minimized.
This comment has been minimized.
|
@dcposch Why not package it as 64-bit (too) ? |
This comment has been minimized.
This comment has been minimized.
|
@dcposch Nice sleuthing! One additional piece of data that would be worth having: Approximately how many torrents did these users have in the app? Even if we keep memory usage low for each active torrent (say ~50MB) we'll still start to feel squeezed for memory once they add around 40 torrents, and run completely out at 80 torrents. We try to use as little memory as possible, but I believe that we keep torrent pieces that are currently being downloaded in memory until they're complete (i.e. all the blocks inside the piece are received). So for active torrents, there could be 5-10 pieces in memory, at a couple MB each (for an average torrent under 10GB), hence the 50MB number. @DiegoRBaquero Here's some context for why we made the decision to go with 32-bit in WD: webtorrent/webtorrent-desktop#437 (comment) Basically, users don't know which installer to use. We thought that 32-bit would have no issues. |
This comment has been minimized.
This comment has been minimized.
|
I'm getting this, along with the create-torrent:
It appears on chrome quickly, on firefox after about 5-6 5-6mb files. I've got a webpack build with v.0.98.20 under linux, chrome 61.0.3163.100 64 Bit and Firefox 56.0 64-bit Thought there might be an issue with Webpack so I put the latest Webtorrent in a script tag, and still get:
This is what's being passed:
|
This comment has been minimized.
This comment has been minimized.
|
When I look at the Uint8Array and try to get the buffer I get
they're being created by:
|
This comment has been minimized.
This comment has been minimized.
|
One of the files is an ArrayBuffer from a regular file upload:
|
This comment has been minimized.
This comment has been minimized.
|
When inspect the Memory in chrome I get what appears to be duplicated Buffers of all the same Alloc. Size:
|
This comment has been minimized.
This comment has been minimized.
|
So to boil it down, I put this together:
It crashes pretty quickly with very little memory use. Not sure it's the same thing as there's no error message printed, but I'd expect 6-7 buffers arn't significant? |
I'm not sure how to test this beyond inspecting the browser. On Chrome I get a Memory footprint of 978 MB with zuul test framework I've also documented buffer overflows here: webtorrent#895 There's some kind of exponential duplication
I'm not sure how to test this beyond inspecting the browser. On Chrome I get a Memory footprint of 978 MB with zuul test framework I've also documented buffer overflows here: webtorrent#895 There's some kind of exponential duplication
This comment has been minimized.
This comment has been minimized.
|
i've got a test up here: It looks like the issue in the browser is an exponential increase in memory usage, from JSArrayBufferData according to the chrome heapsnapshots. The functional software that determines piece length: Is calculating inordinately small pieces (based on whatever the bug is.
The quick fix if you're Generating a seed is to up the piece length. If you're adding and downloading, small piece length torrents are going to eat up the memory leak(?). |
This comment has been minimized.
This comment has been minimized.
|
I have been facing same issue. If anyone knows the solution kindly help me. |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This comment has been minimized.
This comment has been minimized.
|
We're going to start shipping 64-bit only in WebTorrent Desktop, so I expect this error will go away for almost all users. |
This is currently the most frequent uncaught error in the WebTorrent Desktop telemetry. It comes from the underlying library.
As you can see above, we've only seen this error on Windows.
One reason why a buffer allocation can fail is because the OS is out of memory. I don't think that's the case here, though. It affects even systems with lots of memory:
Finally, when this bug starts happening to someone, it tends to happen a lot. Of the ~4000 WebTorrent Desktop telemetry reports from yesterday, only 19 contained this error, but each of those had an average of about 10 "Array buffer allocation failed" errors.