nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.63k stars 2.26k forks source link

run-many only allows for max 3 builds since version 18 #21797

Open richardsengers opened 4 months ago

richardsengers commented 4 months ago

Current Behavior

I'm unable to run multiple builds at once since version 18. I've got a npm script for running 6 projects at once "start:tools" : "nx run-many --projects tools-*,portals-app --target=serve --parallel=6"

As of version 18 only 3 projects are build. I've also noticed that the parallel property in nx.json doesn't do anything image

If i change the default (which was 1) to for example 6 ... and change my npm script to "start:tools" : "nx run-many --projects tools-*,portals-app --target=serve --parallel=true"

only one project is build

Expected Behavior

Running nx run-many --projects tools-*,portals-app --target=serve --parallel=6 should build 6 projects, not just 3

GitHub Repo

No response

Nx Report

Node   : 20.10.0
   OS     : win32-x64
   pnpm   : 8.15.1

   nx (global)        : 18.0.2
   nx                 : 18.0.4
   @nx/jest           : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/angular        : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   @ngneat/transloco        : 4.3.0
   @ngrx/component-store    : 17.1.0
   @ngrx/effects            : 17.1.0
   @ngrx/entity             : 17.1.0
   @ngrx/eslint-plugin      : 17.1.0
   @ngrx/router-store       : 17.1.0
   @ngrx/schematics         : 17.1.0
   @ngrx/store              : 17.1.0
   @ngrx/store-devtools     : 17.1.0
   angular-auth-oidc-client : 16.0.1

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

ahernd2 commented 4 months ago

Seeing the same but only on windows. On wsl (linux) it works fine

AlexPshul commented 4 months ago

I am experiencing something very similar, but I have more projects that can run in parallel. Maybe it is something to do with CPU cores?

P.S. I also run on Windows

Update: Running all 17 projects (which used to work just fine) now starts only about 8 and "ignores" the rest. But if I terminate the command, it looks like the other runs get free and start running in the background. (The fans are getting crazy and CPU usage is spiking)

I was wondering if I can "batch" this to pieces of 8, since individual projects worked well. So after creating a batch of 8 projects, only 4 ran in parallel! I created a batch of 4 projects and only 2 ran. I created a batch of just 2 projects and only 1 ran.

Just running a single project in "a parallel" setup works well. nx run-many --target=start --parallel=20 --projects system

TheWrightDev commented 3 months ago

Thought I was losing my mind when we started experiencing the same thing. On v17 we use nx run-many --target=serve --projects=login,admin,customer --parallel=3 and it would work great. But after trying to upgraded to v18 and now it stops after hosting the first one (at the new little "press h + enter to show help" prompt/message) and doesn't even try to start the others. Sometimes it does actually manage to start 2, but never all 3. I can run each one in it's own shell window and it works, but far from optimal. Also seeing crazy cpu usage as well as each attempt creates instances of cmd.exe that are then forever stuck even after stopping/closing the original prompt window. These instances are each consuming about 10% of the cpu each, so after a few attempts the whole system is slogged until you manually go find and kill all stuck cmd.exe's. Seems like 18 just isn't quite there yet.

richardsengers commented 1 month ago

@xiongemi do you have any plans on looking into this in the near future? :-) This bug is a bit annoying when working with a lot of apps that are depending on each other