gorgeous-winter-99296
11/07/2023, 8:40 PMsubprocess.Popen([sys.executable, '-m', 'our.app.py', '--help']) took 14 seconds before the print.
After digging around a bit, I noticed Pants fails to detect number of CPUs on our infra, and so we end up running with 16 cores instead of the 7 available. That's already 2x oversubscription, plus a ton of IO threads used by everything, also likely based on the 16 core count. The node otherwise looks very healthy, and the only metric that stands out in our dashboards is that during the duration of the test we add 250 PIDs, which goes down by 180 again after the test -- pantsd was a fresh start but I assume it kept running after.
What's interesting is that we haven't really added more tests -- but our testing pexes are really heavy to build. That also correlates with the best reproduction case I have. The flaky test builds a pex fast but does a lot of IO and subprocesses. That then overlaps all our super-heavy PEX builds, and fails. The first heavy PEXs to build can also flake, but the last ones don't. Removing some tests or sharding immediately removes any flakes. As does having a warm cache, even with --force.
I'm now curious whether something similar might be happening on the Pants repo. I've already checked that the CPU count detection works correctly there, which it does. But with only 2 cores available, the margins might be much smaller, and I imagine not all of the subprocesses Pants creates properly scale down to 2 cores -- it's a very low amount...happy-kitchen-89482
11/07/2023, 9:11 PMgorgeous-winter-99296
11/07/2023, 10:14 PMgorgeous-winter-99296
11/07/2023, 10:15 PMhappy-kitchen-89482
11/07/2023, 10:21 PMhappy-kitchen-89482
11/07/2023, 10:24 PMbroad-processor-92400
11/08/2023, 3:00 AMbroad-processor-92400
11/10/2023, 11:09 AMgorgeous-winter-99296
11/10/2023, 11:22 AM