oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.26k stars 2.69k forks source link

`bun install` occasionally fails with parallel runs #12917

Open pistazie opened 1 month ago

pistazie commented 1 month ago

What version of Bun is running?

1.1.21

What platform is your computer?

linux / macOS

What steps can reproduce the bug?

    echo run1 run2 run3 run4 run5 | xargs -n 1 -P 5 sh -c 'bun install'

What is the expected behavior?

It would be great if bun can run parallel. I guess there is some central contention, maybe it can be resolved using locks.

What do you see instead?

No response

Additional information

When bun is parallelly ran (on multiple projects to save time), it tends to fails for some of the executions.

The error message(s) are of the pattern: error: Failed to link {npm-package-name}: EEXIST

Jarred-Sumner commented 1 month ago

We have tests for this, but the tests focus on install rather than linking bins. cc @dylan-conway

yharaskrik commented 1 month ago

I am experiencing this using @sentry/cli

One example from docs:

thomas: error: Failed to link @sentry/cli: EEXIST
polar: Saved lockfile
polar: error: could not determine executable to run for package @sentry/cli

To try and get around it I run bunx @sentry/cli --version not in parallel at the start of CI to install it so later bunx runs shouldn't try and re-install but maybe thats not doing what I want it to.

This just started happening even though this code hasn't changes in quite a while, if I downgrade bun will it work?

Note: This is our production pipeline.