flac.js icon indicating copy to clipboard operation
flac.js copied to clipboard

Crashing on large file size

Open nakedsushi opened this issue 9 years ago • 5 comments

I tried running a large wav file (almost 600M) through flac.js, but it keeps crashing w/ the Chrome "Aw Snap" error message around 49%. Is there another solution for working with large files?

chrome debug log:

<--- Last few GCs --->

   75225 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.1 / 0.0 ms (+ 0.6 ms in 32 steps since last GC) [allocation failure].
   75864 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.1 / 0.0 ms (+ 0.5 ms in 31 steps since last GC) [allocation failure].
   76512 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.2 / 0.1 ms (+ 0.5 ms in 32 steps since last GC) [allocation failure].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2b82e2d48f9 <a DedicatedWorkerGlobalScope with map 0x34aea4d0ca79>
    2: expandFileStorage [0x2b82e204311 <undefined>:~1] [pc=0x389c1778f1c2](this=0x55512f7af41 <an Object with map 0x34aea4d145e1>,node=0x16792c4b5041 <JS Object>,newCapacity=104644370)
    3: write [0x2b82e204311 <undefined>:~1] [pc=0x389c1778caac](this=0x55512f8d391 <an Object with map 0x1642061bfe9>,stream=0x16792c4b51a9 <JS Object>,buffer=0x55512f7b...

nakedsushi avatar Nov 03 '16 20:11 nakedsushi

You could try encoding chunks and glueing them together with an application that has access to a real hard drive, e.g. ffmpeg. If the native flac container doesn't work, use the OGG container format --ogg.

Note that Chrome usually tells you its heap size limit if you ask for it: window.performance.memory.jsHeapSizeLimit

Rillke avatar Nov 17 '16 00:11 Rillke

just ran into this as well, the smallest wav I can make the error happen on is ~120 mb / 30 minute length. Is this fixable in the library?

jtoy avatar May 22 '18 22:05 jtoy

Same problem with (not really) large file ~180 mb / 17 minutes.

Chrome error: "Pause before out of memory crash" on https://github.com/Rillke/flac.js/blob/fa9622d9b52c23574d3f3a6fdc20d614caec7a55/worker/FlacEncoder.js#L155

If I resume it in DevTool it work's fine without crashes.

My DevTool shows:

window.performance.memory.jsHeapSizeLimit 2197815296

It's about 2GB

I use another workers for mp3/wav/ogg encoding with same big files and there is no problem with memory limit.

floydback avatar Aug 19 '19 14:08 floydback

Chrome error: "Pause before out of memory crash" on

If you already have the debugger there, a full stack trace would be nice :)

Rillke avatar Aug 20 '19 21:08 Rillke

Seems Pause before out of memory error came from EmsWorkerProxy.js on the second line of

function _emscripten_memcpy_big(dest, src, num) {
    HEAPU8.set(HEAPU8.subarray(src, src + num), dest); // <-- here error Pause before out of memory
    return dest
}

floydback avatar Jan 21 '20 20:01 floydback