Skip to content

Sharp - Media Upload Memory Leak #14417

@kasonde

Description

@kasonde

Bug report

Required System information

  • Node.js version: 14.19.1
  • NPM version: 6.14.16
  • Strapi version: 4.3.8
  • Database: PostgreSQL
  • Operating system: Linux (Heroku)

Describe the bug

We have a website that depends a lot on media for each product and some products may have a lot of media types like videos audio and images and each one of them may reach 10 to 20 MB. When I try to upload them to Strapi, sometimes due to the size of the media, it not only doesn't upload but also crashes the application itself. We can't upload those files one by one because it affects the user experience a lot so we need to upload them in parallel. This is using the S3 Provider.

Steps to reproduce the behavior

  1. Deploy a Strapi app to Heroku
  2. Attempt to upload a 10MB file
  3. Wait
  4. See error in logs

Error logs

2022-09-03T13:28:13.740126+00:00 heroku[web.1]: Process running mem=1280M(249.9%)
2022-09-03T13:28:13.783638+00:00 heroku[web.1]: Error R15 (Memory quota vastly exceeded)
2022-09-03T13:28:13.791665+00:00 heroku[web.1]: Stopping process with SIGKILL

Additional context

If you have noticed in the message they say 1280 megabytes are used and that's for one person, for one upload operation. Let's say there are 10 people uploading at the same time, do we need 10 gigabytes of ram memory?

Internal TID: 1828

Metadata

Metadata

Assignees

Labels

issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:uploadSource is core/upload packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

Type

No type

Projects

Status

Fixed/Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions