yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.42k stars 1.11k forks source link

[Bug?]: Increasing memory usage after upgrading yarn 1 to yarn 4 #6079

Open rico-fj opened 9 months ago

rico-fj commented 9 months ago

Self-service

Describe the bug

I've notice the increase memory usage after upgrading from yarn V1 into yarn V4. I just want to know if anyone experience same issue after upgrading to yarn V4? thank you

below is image from AWS: image

memory usage goes up after yarn V4 deployment

To reproduce

COPY package.json /app COPY yarn.lock /app

RUN yarn add typescript@^4.1.0 RUN yarn set version 4.0.2 RUN yarn install

CMD yarn run start

Environment

OS: ubuntu
yarn version: 4.0.2
typescript: 4.1.0
node version: 18

Additional context

No response

Nantris commented 1 day ago

This issue is so bad that it causes my system to use 25gb of memory before crashing the computer... Yarn 4 is not usable....

Just a constant upward trend until OOM. Image

Nantris commented 1 day ago

It was silently failing on a postinstall step and looping infinitely. No log was being created for this because the process never ended.

Hopefully this can be fixed.

clemyan commented 1 day ago

@Nantris

silently failing

As far as we know, there is nothing Yarn can do if it was killed due to OOM. There is no event or hooks to handle an OOM.

a postinstall step and looping infinitely

Yarn itself should not hang. If a child is killed while the Yarn process is not, we can catch that. So either there is a bug in Yarn or the postinstall script itself hanged. Do you have a reproduction?

However, that does not sound directly related to the issue, which is about Yarn Modern uses more memory then Yarn Classic in the general case. If you have a reproduction please open a new issue so we can take a look.