Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun install hangs sporadically #5831

Open
silversquirl opened this issue Sep 20, 2023 · 49 comments · Fixed by #6192 · May be fixed by #15511
Open

bun install hangs sporadically #5831

silversquirl opened this issue Sep 20, 2023 · 49 comments · Fixed by #6192 · May be fixed by #15511
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@silversquirl
Copy link
Contributor

silversquirl commented Sep 20, 2023

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Linux 6.4.15-200.fc38.x86_64 x86_64 unknown

What steps can reproduce the bug?

bun install in a project with dependencies, bun add <package>, bunx <package>, etc

What is the expected behavior?

The packages should install quickly

What do you see instead?

Bun gets stuck on 🔍 Resolving [1/1] for minutes at a time, progressing extremely slowly

Additional information

This issue occurs sporadically, but when it does happen it continues happening for a significant period of time (upwards of 10 minutes) and simply killing bun and restarting the install does not help

@silversquirl silversquirl added the bug Something isn't working label Sep 20, 2023
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Sep 20, 2023
@silversquirl
Copy link
Contributor Author

Having done some probing with Wireshark, bun doesn't even appear to be hitting the network, so maybe it's hanging before even making the request?
No clue if this issue is related to #490 but it seems superficially similar

@Jarred-Sumner
Copy link
Collaborator

I suspect its caused by an error causing the install to fail, but still waiting for the pending tasks to complete. I've seen this happen when the same dependencies are declared in devDependencies and regular dependencies.

@silversquirl
Copy link
Contributor Author

If left for long enough, the install will either fail with ConnectionRefused, or occasionally succeed. The same installs also sometimes work perfectly fine in the exact same situation.
And it's definitely not anything to do with package.json because this happens for global installs too.

@silversquirl
Copy link
Contributor Author

I suspect this may be to do with IPv6 issues on my machine - will wait and see if it still happens after fixing those.

If that is the issue, it may be that bun may be locking in to using IPv6 too early, without also trying IPv4 in parallel like curl and most browsers do.

@Jarred-Sumner
Copy link
Collaborator

I think it was due to not handling 304 Not Modified with an unspecified Content-Length while fetching cached manifest entries

If you still see it though, lmk

@woxxo
Copy link

woxxo commented Oct 12, 2023

The same problem with Bun 1.0.6, it hangs for minutes:

$bun x github:piuccio/cowsay
🔍 Resolving [1/1]

@DarkAxi0m
Copy link

I suspect this may be to do with IPv6 issues on my machine - will wait and see if it still happens after fixing those.

If that is the issue, it may be that bun may be locking in to using IPv6 too early, without also trying IPv4 in parallel like curl and most browsers do.

I had this issue too, disabled IPv6, and it worked again.
(Pop!_OS 22.04)

@keisanng
Copy link

keisanng commented Jun 9, 2024

Having this issue all the sudden... latest version of Bun trying to make a SvelteKit app.

@africanmx
Copy link

africanmx commented Jun 23, 2024

this is still alive.... at least it takes a long long time to install any stuff (still sporadically and already made sure it wasn't any other thing)

@eadenink
Copy link

eadenink commented Jul 4, 2024

Also having this issue but the process stucks not on the 🔍 Resolving [1/1] but on dependency install(each time random dependency)
Versions I've tried on: 1.1.6, 1.1.17, 1.1.18, 1.1.18-canary
Clearing cache and even full bun reinstall haven't solve the problem

@africanmx
Copy link

africanmx commented Jul 5, 2024 via email

@whekin
Copy link

whekin commented Jul 5, 2024

My colleague running on intel (x64) macbook reported the same issue. I haven't faced anything like that running on m1 macbook. Though recently it was working fine for both of us

@Jarred-Sumner
Copy link
Collaborator

If you’re still running into this issue

can you run the following

bunx bun-pr jarred/eintr

that will install a copy of bun from #12357 as bun-12357

can you try running bun-12357 install? I’m wondering if the cause is signals being raised from other processes running and interrupting various system calls in unexpected places, which that PR addresses

@eadenink
Copy link

eadenink commented Jul 5, 2024

If you’re still running into this issue

can you run the following

bunx bun-pr jarred/eintr

that will install a copy of bun from #12357 as bun-12357

can you try running bun-12357 install? I’m wondering if the cause is signals being raised from other processes running and interrupting various system calls in unexpected places, which that PR addresses

bunx bun-pr jarred/eintr is stuck just like bun install

@Jarred-Sumner
Copy link
Collaborator

Are you on Linux? Can you set GOMAXPROCS=1 and run perf trace bun install? Might need sudo.

And can you include the package.json + bun.lockb (if it exists. If we can see the system calls then we can It would be helpful to find out which system calls are being run. GOMAXPROCS=1 sets the maximum number of threads to 1 which will make it more deterministic.

@eadenink
Copy link

eadenink commented Jul 5, 2024

Are you on Linux? Can you set GOMAXPROCS=1 and run perf trace bun install? Might need sudo.

And can you include the package.json + bun.lockb (if it exists. If we can see the system calls then we can It would be helpful to find out which system calls are being run. GOMAXPROCS=1 sets the maximum number of threads to 1 which will make it more deterministic.

We found dependency that causing this issue and it's not from npm but in format github:{organization}/{repo}#master
If I remove this dependency bun install works ok
I'm on macbook x64

@africanmx
Copy link

africanmx commented Jul 5, 2024 via email

@eadenink
Copy link

eadenink commented Jul 5, 2024

This and other unreachable assets could be the root cause. I say this because I’ve experienced the Behavior in both cases: Not found assets or bad links, And being nothing at all... it could be maybe a hanging process because a reboot fixes it when you have no broken stuff to fix. Something that needs a reset that makes bun get stuck (yes, deeper than a simpler process kill).

On Fri 5 Jul 2024 at 9:50 Alexander Orlov @.> wrote: Are you on Linux? Can you set GOMAXPROCS=1 and run perf trace bun install? Might need sudo. And can you include the package.json + bun.lockb (if it exists. If we can see the system calls then we can It would be helpful to find out which system calls are being run. GOMAXPROCS=1 sets the maximum number of threads to 1 which will make it more deterministic. We found dependency that causing this issue and it's not from npm but in format github:{organization}/{repo}#master If I remove this dependency bun install works ok I'm on macbook x64 — Reply to this email directly, view it on GitHub <#5831 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALP4QROUC74CCRY4ODANC6LZK3FFRAVCNFSM6AAAAAA5ARWMWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRGE3DCNBUGI . You are receiving this because you commented.Message ID: @.>

Link is ok because my teammate doesn't experiencing any problems with it

@pmbanugo
Copy link

pmbanugo commented Jul 5, 2024

If you’re still running into this issue

can you run the following

bunx bun-pr jarred/eintr

that will install a copy of bun from #12357 as bun-12357

can you try running bun-12357 install? I’m wondering if the cause is signals being raised from other processes running and interrupting various system calls in unexpected places, which that PR addresses

I can't even try that because that also hangs and doesn't exit

@billyadelphia
Copy link

billyadelphia commented Jul 6, 2024

Have the same issue

bun install --verbose
[0.04ms] ".env"
bun install v1.1.18 (5a0b9352)
Loaded 599 hoisted_dependencies
Loaded 1283 resolutions
Loaded 1283 dependencies
Loaded 12 extern_strings
Loaded 45298 string_bytes
Clean lockfile: 570 packages - 570 packages in 1.3ms
info: cannot move files from tempdir: RenameAcrossMountPoints, using fallback
  🔍 Resolving... [PackageManager] waiting for 2 tasks
  🔍 Resolving... [PackageManager] waiting for 2 tasks
  🔍 Resolving... [PackageManager] waiting for 2 tasks
  🔍 Resolving... [PackageManager] waiting for 2 tasks

just wondering, what are those 2 tasks on the log ?

@farhan-helmy
Copy link

Also facing the same error, running ubuntu 20 here

@ramonmalcolm10
Copy link

ramonmalcolm10 commented Jul 15, 2024

Facing the same issue with Debian with version > 1.1.18

@pmbanugo
Copy link

For me I was using a VPN, and disabling that worked. Might be the same issue for some here.

@EdgarNan
Copy link

I'm still facing this issue in ubuntu 22.04

@ramonmalcolm10
Copy link

Facing the same issue with Debian with version > 1.1.18

Issue was resolved for me, I was using docker:19-dind instead of the latest version.

@Holmes-EH
Copy link

Holmes-EH commented Sep 1, 2024

I came across this issue on OSX 14.6 after pulling changes made from a different machine, also running OSX 14.6.
Could very well be unrelated, but after deleting bun.lockb, bun install command ran perfectly fine.

@Jhonneg
Copy link

Jhonneg commented Sep 4, 2024

Ran into this problem today on PopOs 22.04.

@jhaemin
Copy link

jhaemin commented Sep 6, 2024

bun install often hangs on a random dependency especially when I try to install inside projects where bun.lockb is generated by previous versions of Bun. Normal internet connection, no VPN.

It also happens when I try to install on Linux with the bun.lockb generated on macOS.

To fix it, just delete bun.lockb and reinstall.

@nemanjamitric
Copy link

I'm sorry @jhaemin, but this isn't true. I tried with and without bun.lockb in project, also with and without VPN turned on. Nothing in the thread so far fixed the issue for me.

@jhaemin
Copy link

jhaemin commented Sep 9, 2024

@nemanjamitric Yeah, unfortunately sometimes it works and sometimes not. Do you still have problem after deleting both node_modules and bun.lockb? Never happened on a clean project directory for me.

@nemanjamitric
Copy link

@jhaemin unfortunately yes. I've been trying to fix it for a week now... I just wanted to mention that it's not a definitive fix to keep the thread open.

@jhaemin
Copy link

jhaemin commented Sep 9, 2024

@nemanjamitric I agree that deleting lockb is not a definitive fix. The issue should be reopened.

@goblinfactory
Copy link

I've not been using bun for a while; today tried to install a package and Bun was hanging 100% of the time.
In my case, disabling cloudlfare WARP instantly solved the problem.
Dropping this here in case it helps someone else.

@nrbrttth
Copy link

Ran into this problem on Windows 11. In case someone have the same issue on Windows, the solution was to disable Ethernet in Advanced network settings, and then re-enable it.

@ivs
Copy link

ivs commented Oct 8, 2024

Same here, wsl and Cloudflare Warp was lead to hangs on Reslolving

@vinayakkulkarni
Copy link

Wasted ~3 hours on this, eventually migrated my Dockerfile to node:latest and everything worked like a charm!

@alanpog
Copy link

alanpog commented Oct 14, 2024

This issue should be reopened.

@kwiat1990
Copy link

I’m having the issue right now on MacOS and I’ve tried already to delete lock files. It didn’t work. But what has worked is to re-connect internet connection. Someone above mentioned it for Windows and Ethernet. I have reconnected my WiFi and I solved the issue. Pretty weird error and fix as well.

@jane-212
Copy link

I’m having the issue right now on MacOS and I’ve tried already to delete lock files. It didn’t work. But what has worked is to re-connect internet connection. Someone above mentioned it for Windows and Ethernet. I have reconnected my WiFi and I solved the issue. Pretty weird error and fix as well.

I'm having this issue on MacOS too, I deleted the folder ~/.bun and solved the issue.

@anggakharisma
Copy link

anggakharisma commented Oct 26, 2024

Yeah, i also have this issue, usually i would stop the running process and restart but it's kinda inconvenient.

@jhaemin
Copy link

jhaemin commented Oct 26, 2024

#4066 Is this issue related?
Bun v1.1.33 includes the fix so I hope it is now resolved.

@hari4698
Copy link

I'm on Bun v1.1.33, Ubuntu 24.04.1 LTS

I am still facing this issue. I'm not using any proxy.

@Eiley2
Copy link

Eiley2 commented Oct 30, 2024

I'm on Bun v1.1.33 on Arch btw. I've tried restarting my pc, downgrading and reinstalling. I'm not using any vpn or warp. Sounds like something on my side maybe?

❯ bun i --verbose 
[0.01ms] ".env"
bun install v1.1.33 (247456b6)
info: cannot move files from tempdir: RenameAcrossMountPoints, using fallback
Enqueue package manifest for download: @biomejs/biome
Enqueue package manifest for download: @remix-run/dev
Enqueue package manifest for download: @types/react
Enqueue package manifest for download: @types/react-dom
Enqueue package manifest for download: autoprefixer
Enqueue package manifest for download: drizzle-kit
Enqueue package manifest for download: postcss
Enqueue package manifest for download: remix-flat-routes
Enqueue package manifest for download: tailwindcss
Enqueue package manifest for download: typescript
Enqueue package manifest for download: vite
Enqueue package manifest for download: vite-tsconfig-paths
Enqueue package manifest for download: @radix-ui/react-avatar
Enqueue package manifest for download: @radix-ui/react-scroll-area
Enqueue package manifest for download: @radix-ui/react-slot
Enqueue package manifest for download: @remix-run/node
Enqueue package manifest for download: @remix-run/react
Enqueue package manifest for download: @remix-run/serve
Enqueue package manifest for download: class-variance-authority
Enqueue package manifest for download: clsx
Enqueue package manifest for download: drizzle-orm
Enqueue package manifest for download: drizzle-zod
Enqueue package manifest for download: isbot
Enqueue package manifest for download: lucide-react
Enqueue package manifest for download: postgres
Enqueue package manifest for download: react
Enqueue package manifest for download: react-dom
Enqueue package manifest for download: tailwind-merge
Enqueue package manifest for download: tailwindcss-animate
  🔍 Resolving [1/29] [PackageManager] waiting for 29 tasks
  🔍 Resolving [1/29] [PackageManager] waiting for 29 tasks
  🔍 Resolving [1/29] [PackageManager] waiting for 29 tasks
  🔍 Resolving [1/29] [PackageManager] waiting for 29 tasks
[PackageManager] waiting for 29 tasks

@HarjjotSinghh
Copy link

The bun install step in my Dockerfile hangs every time.

Here is the Dockerfile:

FROM oven/bun:1.1.34

WORKDIR /app

RUN apt-get update && apt-get install -y \
    python3 \
    python-is-python3 \
    make \
    g++ \
    curl

COPY package.json turbo.json ./

COPY apps/frontend/package.json ./apps/frontend/
COPY apps/backend/package.json ./apps/backend/

# This step always hangs
RUN bun install --production --frozen-lockfile
 
COPY apps ./apps

EXPOSE 8000 5050 4000

ENV NODE_ENV=production

WORKDIR /app/apps/backend

CMD ["bun", "run", "dev"]

And here are the logs:

Step 17/27 : RUN bun install --production --frozen-lockfile
 ---> Running in f56105ef21df
bun install v1.1.34 (5e5e7c60)
Resolving dependencies
Resolved, downloaded and extracted [7718]

It never reaches step 18. No errors, it just freezes.

@Michota
Copy link

Michota commented Nov 21, 2024

same issue here...

@darkyelox
Copy link

experiencing the same thing, very frustrating the amount of time I have wasted

@fanesz
Copy link

fanesz commented Nov 30, 2024

same here,
Ubuntu 22.04.5 LTS x86_64
Bun 1.1.38

$ bun i --verbose
[0.05ms] ".env"
bun install v1.1.38 (bf2f153f)
Loaded 306 hoisted_dependencies
Loaded 443 resolutions
Loaded 443 dependencies
Loaded 4 extern_strings
Loaded 22270 string_bytes
Enqueue package manifest for download: @types/mongoose
  🔍 Resolving [1/1] [PackageManager] waiting for 1 tasks
  🔍 Resolving [1/1] [PackageManager] waiting for 1 tasks
  🔍 Resolving [1/1] [PackageManager] waiting for 1 tasks
  🔍 Resolving [1/1] [PackageManager] waiting for 1 tasks
....

edit: turn off ipv6 and it works

@tiagorangel1
Copy link

tiagorangel1 commented Dec 1, 2024

Same problem. Disabling ipv6 fixed it. Also on bunx, bun outdated, etc. On Ubuntu

tiago@tiago: $ bun i --verbose --force
[0.06ms] ".env"
bun install v1.1.38 (bf2f153f)
Loaded 2 hoisted_dependencies
Loaded 2 resolutions
Loaded 2 dependencies
Loaded 0 extern_strings
Loaded 139 string_bytes
Clean lockfile: 3 packages - 3 packages in 94.8us
info: cannot move files from tempdir: RenameAcrossMountPoints, using fallback
[PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
[PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
[PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
[PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
[PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
  🔍 Resolving... [PackageManager] waiting for 1 tasks
...
(it gets stuck on this)

@HarjjotSinghh
Copy link

Switching to the node image as the base resolved the issue for me. Here's the updated Dockerfile that works without hanging:

FROM node:20.18.0

WORKDIR /app

# Install Bun and other dependencies
RUN apt-get update -qq && apt-get install -y -qq \
    python3 \
    python-is-python3 \
    make \
    g++ \
    bash \
    curl \
    build-essential \
    node-gyp \
    python3-pip && \
    curl -fsSL https://bun.sh/install | bash

# Add Bun to PATH
ENV PATH="/root/.bun/bin:${PATH}"

COPY package.json turbo.json ./

COPY apps/frontend/package.json ./apps/frontend/
COPY apps/backend/package.json ./apps/backend/

# This step does not hang/freeze anymore
RUN bun install

COPY packages ./packages
COPY apps ./apps

EXPOSE 8000 5050 4000

ENV NODE_ENV=production

WORKDIR /app/apps/backend

CMD ["bun", "run", "dev"]

In this version, the bun install step works as expected. I'm not entirely sure why it hangs when using the oven/bun base image but switching to node resolved it in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet