multer icon indicating copy to clipboard operation
multer copied to clipboard

fix: MEMORY LEAK

Open UnlimitedBytes opened this issue 3 years ago • 6 comments

One important caveat was ignored by piping request stream to busboy stream. This commit aknowledges that caveat by closing busboy stream when request stream encounters an error. More information about this caveat can be found on https://nodejs.org/api/stream.html#readablepipedestination-options.

One important caveat is that if the Readable stream emits an error during processing, the Writable destination is not closed automatically. If an error occurs, it will be necessary to manually close each stream in order to prevent memory leaks.

This PR also fixes multiple issues that are caused by this caveat some are listed blow.

  • #259
  • #256
  • #38
  • (maybe) #53
  • (maybe) #1058

Some PR's (that may introduce breaking changes) are closed by this PR also (without breaking changes) and some are listed blow.

  • #1117
  • #971
  • #438
  • #429

PLEASE MERGE THIS BECAUSE IT'S INSANE ANNOYING HAVING TO RELAUNCH THE SERVER EVERY DAY BECAUSE THOUSANDS OF OPEN STREAMS ARE NOT CLOSED (MEMORY LEAKS)

@LinusU here is a not breaking change that will fix all the above.

UnlimitedBytes avatar Jul 10 '22 18:07 UnlimitedBytes

Sorry for the late reply, this looks good 👍

Only have one question, will the next be called with an error when this happens? Could you add a test case covering this?

LinusU avatar Oct 30 '22 14:10 LinusU

Bump

titanism avatar Nov 22 '22 01:11 titanism

@LinusU Merger?

r4881t avatar Jan 11 '23 07:01 r4881t

@LinusU we can gladly help merge and release here - also see #1161

titanism avatar Jan 11 '23 18:01 titanism

@LinusU Can you please merge this? Servers that use multer are exposed to DOS attacks!

iMrDJAi avatar May 15 '23 16:05 iMrDJAi

Bump, can we merge this please?

Stanback avatar Sep 12 '23 18:09 Stanback