yarnpkg / berry

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

[Bug?]: Asymmetric circular deps in workspaces will cause an out of memory failure #3658

Open dumconstantin opened 3 years ago

dumconstantin commented 3 years ago

Self-service

Describe the bug

I'm using yarn 3 in a monorepo where there are two packages A and B.

Package A has a runtime dependency to package B. Package B has a development dependency to package A - i.e package A is only used in the testing suite which is run with jest and not imported by the B package itself.

As such, the dependency is only at a package.json level and not at a code level.

When running yarn commands yarn build or yarn test they fail with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory.

You can see the actual issue occurring here: https://github.com/code11/engine/runs/4021136825?check_suite_focus=true#step:7:14

Note that running yarn run test will execute accordingly.

The problem happens because of this circular dependency: Package A's package.json Package B's package.json

If I remove the engine.babel-plugin-syntax dependency (also this extra dep) from the engine.utils package then yarn build works as expected.

If there is a yarn setting that I can use to bypass this issue, please let me know.

Note that yarn install works fine.

Expected: yarn build and yarn test to continue working with asymmetric circular deps.

To reproduce

I don't know how to write a reproduction of a monorepo with workspaces in sherlock, and seems a bit tedious at this point. I hope the provided information and reproduction on a live repo is enough to at least get the issue reviewed.

Environment

System:
    OS: Linux 4.19 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
  Binaries:
    Node: 14.17.0 - /tmp/xfs-b54599f4/node
    Yarn: 3.0.2 - /tmp/xfs-b54599f4/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v14.17.0/bin/npm

Additional context

image

yarnbot commented 2 years ago

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟