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

md5(buf) resulting in JavaScript heap out of memory #83

Closed
FrozenJun opened this issue Jun 6, 2018 · 2 comments
Closed

md5(buf) resulting in JavaScript heap out of memory #83

FrozenJun opened this issue Jun 6, 2018 · 2 comments

Comments

@FrozenJun
Copy link

I uploaded a 100M video causing memory overflow.

<--- Last few GCs --->

[14007:0x103001200]    12347 ms: Mark-sweep 229.1 (271.0) -> 177.9 (231.0) MB, 41.3 / 0.0 ms  (+ 53.3 ms in 81 steps since start of marking, biggest step 1.8 ms, walltime since start of marking 274 ms) allocation failure GC in old space requested
[14007:0x103001200]    14310 ms: Mark-sweep 621.2 (667.5) -> 463.5 (513.0) MB, 207.8 / 0.0 ms  (+ 27.1 ms in 5 steps since start of marking, biggest step 8.0 ms, walltime since start of marking 923 ms) allocation failure GC in old space requested


<--- JS stacktrace --->

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

Security context: 0x2cd48a29bbd9 <JS Object>
    1: SimpleSlice(aka SimpleSlice) [native array.js:~212] [pc=0x17e3b0bfaeda](this=0x2cd48a282241 <undefined>,p=0xd42cd083271 <an Uint8Array with map 0xfd34cbbeab1>,O=0,P=108646049,Q=108646049,R=0xd42cd083429 <JS Array[108646049]>)
    2: ArraySlice [native array.js:1] [pc=0x17e3b0bfac58](this=0xd42cd083271 <an Uint8Array with map 0xfd34cbbeab1>,as=0,at=0x2cd48a282241 <undefined>)
    3: argum...

FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory

After commenting the code md5(buf), the error disappears.I think the whole data of MD5 may have problems.

@lucydjo
Copy link

lucydjo commented Jun 13, 2018

Edit line 140 of node_modules/express-fileupload/lib/index.js.

let newFile = {
name: filename,
data: buf,
encoding: encoding,
truncated: file.truncated,
mimetype: mime,
md5: md5(buf), <<<---- REMOVE THIS
mv: function(path, callback) {
// Callback is passed in, use the callback API
if (callback) {

@richardgirges
Copy link
Owner

Should be fixed now in v1.0.0-alpha.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants