oven-sh / bun

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

bun install takes extremely long time #4066

Closed alyiev closed 1 week ago

alyiev commented 1 year ago

What platform is your computer?

Darwin 22.6.0 arm64 arm

How did you attempt to install or upgrade?

bun install

What do you see instead?

bun install bun install v0.7.3 (a9b3d583)

Additional information

Trying to install those packages:

"dependencies": {
    "@expo-google-fonts/andika": "^0.2.3",
    "@expo/vector-icons": "^13.0.0",
    "@reduxjs/toolkit": "^1.9.5",
    "@tamagui/animations-moti": "^1.43.16",
    "@tamagui/animations-react-native": "^1.43.16",
    "@tamagui/config": "^1.43.16",
    "@tamagui/shorthands": "^1.43.16",
    "@tamagui/themes": "^1.43.16",
    "expo": "^49.0.6",
    "expo-constants": "~14.4.2",
    "expo-font": "~11.4.0",
    "expo-linking": "~5.0.2",
    "expo-location": "~16.1.0",
    "expo-random": "^13.1.1",
    "expo-router": "2.0.0",
    "expo-splash-screen": "~0.20.4",
    "expo-status-bar": "~1.6.0",
    "immer": "^10.0.2",
    "lodash-es": "^4.17.21",
    "ramda": "^0.28.0",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "0.72.3",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-maps": "1.7.1",
    "react-native-mmkv": "^2.10.1",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-web": "~0.19.6",
    "react-redux": "^8.1.1",
    "redux-persist": "^6.0.0",
    "tamagui": "^1.43.16",
    "zustand": "^4.3.6"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@tamagui/babel-plugin": "^1.43.16",
    "@types/lodash-es": "^4.17.7",
    "@types/ramda": "^0.28.23",
    "@types/react": "~18.2.14",
    "@types/uuid": "^9.0.1",
    "babel-plugin-transform-inline-environment-variables": "^0.4.4",
    "eslint": "^8.45.0",
    "eslint-config-airbnb-typescript-prettier": "^5.0.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-import": "^2.28.0",
    "eslint-plugin-prettier": "5.0.0",
    "expo-dev-client": "^2.4.6",
    "prettier": "^3.0.0",
    "react-devtools": "^4.27.2",
    "typescript": "^5.1.3"
  },
yairyairyair commented 2 months ago

I think i found the bug, usually people do COPY package*.json ./ and dont copy the bun.lockb

i changed it to

COPY package.json bun.lockb ./

and now it works

Jarred-Sumner commented 2 months ago

yeah if you're not copying a lockfile, it's going to have to re-resolve everything and that takes time

a3l6 commented 2 months ago

Having this exact same issue here with only these packages

"devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/kit": "^1.20.4", "@types/chrome": "^0.0.243", "@types/node": "^20.3.2", "@types/zxcvbn": "^4.4.1", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", "autoprefixer": "^10.4.14", "daisyui": "^3.1.6", "eslint": "^8.28.0", "eslint-plugin-svelte": "^2.30.0", "postcss": "^8.4.24", "svelte": "^4.0.0", "svelte-check": "^3.4.3", "sveltekit-adapter-chrome-extension": "^2.0.0", "tailwindcss": "^3.3.2", "tslib": "^2.4.1", "typescript": "^5.0.0", "vite": "^4.3.6" }, "type": "module", "dependencies": { "@macfja/svelte-persistent-store": "^2.3.1", "@sveu/browser": "^0.20.0", "@types/bytebuffer": "^5.0.44", "@types/dom-view-transitions": "^1.0.5", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", "bytebuffer": "^5.0.1", "events": "^3.3.0", "process": "^0.11.10", "stream-browserify": "^3.0.0", "util": "^0.12.5", "fast-sha256": "^1.1.0", "tweetnacl-util": "^0.15.0", "vite-plugin-require": "^1.1.10", "zxcvbn": "^4.4.2" }

Robert27 commented 2 months ago

Same here, I’m using bun install on Xcode Cloud: Stuck / Timout. Obviously I can’t change any DNS settings.

wladpaiva commented 2 months ago

Tried with and without the bun.lockb. Either way are overpassing 50min for me. Only inside the docker. On the m2 is working fine

tpSpace commented 2 months ago

For me, changing my DNS server actually resolved the problem!

It works for me too. I turn off cloudfare 1.1.1.1 and it works like a champ.

Shiwa commented 1 month ago

I encountered a similar issue with bun getting stuck on the resolve phase. I tried the "disable ipv6" fix but it did not work. Then I noticed i didn’t get the problem when running the install from the webstorm notification…

It turns out bun install is fast (~500ms) when launched from bash, but slooooow (>30s, killed the process) when launched from the fish shell. No idea why. I’m on ubuntu 22, no docker.

PS: my fish shell is launched from my .bashrc, if that may help

chlorine3545 commented 1 month ago

Here it continues to bother me. Just 4 packages, it took 10min to install, while npm was 3s. macOS Sonoma, Zsh, bun 1.1.27.

vincehi commented 1 month ago

same for me 😅 => 411s

image
chardoncs commented 1 month ago

Same here. It doesn't always happen, but sometimes might take a very long time then timeout.

@choopk if you do rm -rf ~/.bun/install node_modules bun.lockb in your project, does that help?

Welp... this works 😅

nemanjamitric commented 1 month ago

Tried everything in the thread. bun install on v1.1.29 still not working on arm64 macbook

chlorine3545 commented 1 month ago

After updating my system to macOS Sequoia and Bun to version 1.1.29, the situation has worsened. Since I rely on Bun as my primary JavaScript runtime, this issue is incredibly frustrating!

alyiev commented 1 month ago

@Jarred-Sumner hi, maybe it's a good time to re-open issue and fix it? People still facing it

jhokam commented 1 month ago

image

i got same problem when using bun, but trying to use npm that work

irvile commented 1 month ago

when I encounter this issue, I just turn the Wi-Fi off and on, and it works.

I first experienced this a long time ago, but with version 1.1.29, it happened again once.

By the way, I'm using macOS Sonoma.

chardoncs commented 1 month ago

Here is part of the debug info about running Bun 1.1.30-debug to install dependencies for a newly created SvelteKit project. I'm trying addressing the issue, but I don't have any guarantees 😬

  🔍 typescript [9/19] [SYS] write(7[/home/chardon/.bun/install/cache/#75636696 (deleted)], 1159280) = 1159280 0.600ms
[SYS] unlinkat(15[/home/chardon/.bun/install/cache], 6265852b2c80259f.npm) = 0
[SYS] close(7[/home/chardon/.bun/install/cache/#75636696 (deleted)])
[alloc] destroy(SaveTask) = src.install.npm.PackageManifest.Serializer.saveAsync.SaveTask@2000e2a05c0
  🔍 typescript [9/19] [fetch] Timeout  https://registry.npmjs.org/vite
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002cd8800
[fetch] onAsyncHTTPCallback: 5m11.569ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@2000231ac00
[uws] us_socket_close(133216329583360)
  🔍 vite [10/20] [fetch] Timeout  https://registry.npmjs.org/svelte-check
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002cd0e80
[fetch] onAsyncHTTPCallback: 5m22.224ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002318800
[uws] us_socket_close(133216329583072)
[fetch] Timeout  https://registry.npmjs.org/svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026de500
[fetch] onAsyncHTTPCallback: 5m30.699ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002317c00
[uws] us_socket_close(133216329582976)
[fetch] Timeout  https://registry.npmjs.org/prettier-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026dbc80
[fetch] onAsyncHTTPCallback: 5m40.34ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002317000
[uws] us_socket_close(133216329582880)
[fetch] Timeout  https://registry.npmjs.org/prettier
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d9400
[fetch] onAsyncHTTPCallback: 5m52.229ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002316400
[uws] us_socket_close(133216329582784)
[fetch] Timeout  https://registry.npmjs.org/eslint-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d4300
[fetch] onAsyncHTTPCallback: 5m61.59ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002314c00
[uws] us_socket_close(133216329582592)
[fetch] Timeout  https://registry.npmjs.org/eslint
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d1a80
[fetch] onAsyncHTTPCallback: 5m71.275ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002314000
[uws] us_socket_close(133216329582496)
  🔍 eslint [16/26] [fetch] Timeout  https://registry.npmjs.org/@types%2feslint
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216f100
[fetch] onAsyncHTTPCallback: 5m80.264ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002313400
[uws] us_socket_close(133216329582400)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fvite-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216c880
[fetch] onAsyncHTTPCallback: 5m89.888ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002310400
[uws] us_socket_close(133216329582304)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fkit
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216a000
[fetch] onAsyncHTTPCallback: 5m99.474ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002311000
[uws] us_socket_close(133216329582208)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fadapter-auto
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002167780
[fetch] onAsyncHTTPCallback: 5m113.508ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002312800
[uws] us_socket_close(133216329582112)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002312800
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002311000
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002310400
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002313400
[uws] connect(127.0.0.1, 7890)
[fetch] Processed 4 tasks
[fetch] Connected https://registry.npmjs.org/vite
[uws] us_socket_write(*anyopaque@7, 103) = 103
[fetch] Connected https://registry.npmjs.org/svelte-check
[uws] us_socket_write(*anyopaque@e, 103) = 103
[fetch] Connected https://registry.npmjs.org/svelte
[uws] us_socket_write(*anyopaque@12, 103) = 103
[fetch] Connected https://registry.npmjs.org/prettier-plugin-svelte
[uws] us_socket_write(*anyopaque@13, 103) = 103
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@20002167780
[uws] us_socket_write(*anyopaque@7, 537) = 537
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216a000
[uws] us_socket_write(*anyopaque@e, 517) = 517
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216c880
[uws] us_socket_write(*anyopaque@12, 517) = 517
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216f100
[uws] us_socket_write(*anyopaque@13, 517) = 517
[fetch] onData 3034
[uws] us_socket_write(*anyopaque@e, 93) = 93
[fetch] onData 3036
[uws] us_socket_write(*anyopaque@7, 93) = 93
[fetch] onData 3034
[uws] us_socket_write(*anyopaque@12, 93) = 93
[fetch] onData 3035
[uws] us_socket_write(*anyopaque@13, 93) = 93
  🔍 @sveltejs/adapter-auto [20/30] [fetch] onData 258
[uws] us_socket_write(*anyopaque@e, 310) = 310
[fetch] onData 258
[uws] us_socket_write(*anyopaque@7, 302) = 302
[fetch] onData 258
[uws] us_socket_write(*anyopaque@13, 320) = 320
[fetch] onData 258
[uws] us_socket_write(*anyopaque@12, 304) = 304
[fetch] onData 380
[fetch] onData decoded 351
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 379
[fetch] onData decoded 350
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 380
[fetch] onData decoded 351
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 379
[fetch] onData decoded 350
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
Jarred-Sumner commented 1 month ago

cc @cirospaciari , looks like it's related to proxy tunnel

Here is part of the debug info about running Bun 1.1.30-debug to install dependencies for a newly created SvelteKit project. I'm trying addressing the issue, but I don't have any guarantees 😬

  🔍 typescript [9/19] [SYS] write(7[/home/chardon/.bun/install/cache/#75636696 (deleted)], 1159280) = 1159280 0.600ms
[SYS] unlinkat(15[/home/chardon/.bun/install/cache], 6265852b2c80259f.npm) = 0
[SYS] close(7[/home/chardon/.bun/install/cache/#75636696 (deleted)])
[alloc] destroy(SaveTask) = src.install.npm.PackageManifest.Serializer.saveAsync.SaveTask@2000e2a05c0
  🔍 typescript [9/19] [fetch] Timeout  https://registry.npmjs.org/vite
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002cd8800
[fetch] onAsyncHTTPCallback: 5m11.569ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@2000231ac00
[uws] us_socket_close(133216329583360)
  🔍 vite [10/20] [fetch] Timeout  https://registry.npmjs.org/svelte-check
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002cd0e80
[fetch] onAsyncHTTPCallback: 5m22.224ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002318800
[uws] us_socket_close(133216329583072)
[fetch] Timeout  https://registry.npmjs.org/svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026de500
[fetch] onAsyncHTTPCallback: 5m30.699ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002317c00
[uws] us_socket_close(133216329582976)
[fetch] Timeout  https://registry.npmjs.org/prettier-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026dbc80
[fetch] onAsyncHTTPCallback: 5m40.34ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002317000
[uws] us_socket_close(133216329582880)
[fetch] Timeout  https://registry.npmjs.org/prettier
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d9400
[fetch] onAsyncHTTPCallback: 5m52.229ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002316400
[uws] us_socket_close(133216329582784)
[fetch] Timeout  https://registry.npmjs.org/eslint-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d4300
[fetch] onAsyncHTTPCallback: 5m61.59ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002314c00
[uws] us_socket_close(133216329582592)
[fetch] Timeout  https://registry.npmjs.org/eslint
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@200026d1a80
[fetch] onAsyncHTTPCallback: 5m71.275ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002314000
[uws] us_socket_close(133216329582496)
  🔍 eslint [16/26] [fetch] Timeout  https://registry.npmjs.org/@types%2feslint
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216f100
[fetch] onAsyncHTTPCallback: 5m80.264ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002313400
[uws] us_socket_close(133216329582400)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fvite-plugin-svelte
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216c880
[fetch] onAsyncHTTPCallback: 5m89.888ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002310400
[uws] us_socket_close(133216329582304)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fkit
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@2000216a000
[fetch] onAsyncHTTPCallback: 5m99.474ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002311000
[uws] us_socket_close(133216329582208)
[fetch] Timeout  https://registry.npmjs.org/@sveltejs%2fadapter-auto
[alloc] destroy(ProxyTunnel) = src.http.ProxyTunnel@20002167780
[fetch] onAsyncHTTPCallback: 5m113.508ms
[alloc] destroy(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002312800
[uws] us_socket_close(133216329582112)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002312800
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002311000
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002310400
[uws] connect(127.0.0.1, 7890)
[alloc] new(ThreadlocalAsyncHTTP) = src.http.ThreadlocalAsyncHTTP@20002313400
[uws] connect(127.0.0.1, 7890)
[fetch] Processed 4 tasks
[fetch] Connected https://registry.npmjs.org/vite
[uws] us_socket_write(*anyopaque@7, 103) = 103
[fetch] Connected https://registry.npmjs.org/svelte-check
[uws] us_socket_write(*anyopaque@e, 103) = 103
[fetch] Connected https://registry.npmjs.org/svelte
[uws] us_socket_write(*anyopaque@12, 103) = 103
[fetch] Connected https://registry.npmjs.org/prettier-plugin-svelte
[uws] us_socket_write(*anyopaque@13, 103) = 103
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@20002167780
[uws] us_socket_write(*anyopaque@7, 537) = 537
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216a000
[uws] us_socket_write(*anyopaque@e, 517) = 517
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216c880
[uws] us_socket_write(*anyopaque@12, 517) = 517
[fetch] onData 39
[alloc] new(ProxyTunnel) = src.http.ProxyTunnel@2000216f100
[uws] us_socket_write(*anyopaque@13, 517) = 517
[fetch] onData 3034
[uws] us_socket_write(*anyopaque@e, 93) = 93
[fetch] onData 3036
[uws] us_socket_write(*anyopaque@7, 93) = 93
[fetch] onData 3034
[uws] us_socket_write(*anyopaque@12, 93) = 93
[fetch] onData 3035
[uws] us_socket_write(*anyopaque@13, 93) = 93
  🔍 @sveltejs/adapter-auto [20/30] [fetch] onData 258
[uws] us_socket_write(*anyopaque@e, 310) = 310
[fetch] onData 258
[uws] us_socket_write(*anyopaque@7, 302) = 302
[fetch] onData 258
[uws] us_socket_write(*anyopaque@13, 320) = 320
[fetch] onData 258
[uws] us_socket_write(*anyopaque@12, 304) = 304
[fetch] onData 380
[fetch] onData decoded 351
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 379
[fetch] onData decoded 350
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 380
[fetch] onData decoded 351
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
[fetch] onData 379
[fetch] onData decoded 350
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http.Encoding.identity
ekorian commented 1 month ago

Issue is still up

KieranP commented 1 month ago

Encountering the same issue. Since upgrading to Sonoma, bun install, bun add, or other similar operations are taking many orders of magnitude longer than they should. Would be great to have a fix for this in next release.

nvcnvn commented 1 month ago

I'm using Cloudflare Warp on Ubuntu, need to disable it to make it work.

mancuoj commented 3 weeks ago
❯ npx @mancuoj/prettier-config
Need to install the following packages:
@mancuoj/prettier-config@0.2.0
Ok to proceed? (y) 

Installing required packages: prettier, @mancuoj/prettier-config
bun add v1.1.30 (7996d06b)

installed prettier@3.3.3 with binaries:
 - prettier
installed @mancuoj/prettier-config@0.2.0 with binaries:
 - prettier-config

14 packages installed [60.66s]
✔ Prettier setup successfully!

still exist on macOS15, can someone check it?

marvinfok commented 3 weeks ago

My first time doing a bun expo app installation. Was very slow on a Macbook arm64 Ventura 13.6. What can be the issue?

Update: Issue solved by upgrading to canary.

chardoncs commented 3 weeks ago

I just tried Bun compiled from the main branch, it still exists.

Btw update seems not affected, only install and add. Is there any difference between the fetching of update and install/add?

shanearcaro commented 2 weeks ago

Running into this using Mac Sequoia 15.0 and bun latest. The project only has 12 dependencies and the installation step took 423.8s to complete but using yarn it took 19.9s.

Jarred-Sumner commented 2 weeks ago

There are enough reports of this that I think we should re-open the issue and investigate what's going on.

That being said, we're going to need a way to consistently reproduce this

If you're running into this issue, can you provide a reproduction?

chardoncs commented 2 weeks ago

I tried to debug days back, but it just ended up ticking endlessly on uWebSocket.

If you're running into this issue, can you provide a reproduction?

This issue appears when there are many cached packages in ~/.bun/install/cache.

And it just gets stuck on bun install or bun add <packages>, but bun update is fine.

Jarred-Sumner commented 1 week ago

Turns out, bun install's default simultaneous network connection limit is 256. This limit was meant for the runtime where the idea of fetch limiting the number of simultaneous requests is somewhat confusing (it is unfortunately necessary for overall system stability), but for install - it's way too high. Especially when you're potentially downloading megabytes of tarballs simultaneously. It will make each individual network request very slow and potentially use more memory than it should since it will be storing more in-flight requests.

In #14755, I made the default limit 48. npm client default limit
npm v10 20
pnpm 16
yarn berry 50
bun install < v1.1.33 256
bun install > v1.1.33 48

When a proxy is detected, we reduce the limit to 16.

To configure the limit, I've also added a --network-concurrency=<num> flag (to go with the BUN_CONFIG_MAX_HTTP_REQUESTS env var) to override this

From testing in the test folder in bun's repo on 800mbps internet, 40-50 seems to be the sweet spot. 16 makes it statistically slower. More than 50 doesn't make it faster. It looks like about 400ms of time is spent in the HTTP thread decompressing brotli responses, which implies we should move that to the other thread.

Image

chardoncs commented 1 week ago

Thank you for taking time on solving the issue! Much appreciate it!

Actually I'm using a proxy all the time, so such issue could be obvious for me. 🤔

mancuoj commented 1 week ago

Chinese users use proxy every time, the limit on proxy seems unacceptable

Jarred-Sumner commented 1 week ago

The assumption I’m making for proxies is that a proxy has a much lower limit than what would normally work well. You can manually verify this with BUN_CONFIG_MAX_HTTP_REQUESTS=16 in any recent version of Bun. What number for that environment variable installs fastest for you?

Make sure to rm -rf node_modules bun.lockb ~/.bun/install/cache between runs and pass --ignore-scripts to reduce noise

chardoncs commented 1 week ago

You can manually verify this with BUN_CONFIG_MAX_HTTP_REQUESTS=16 in any recent version of Bun. What number for that environment variable installs fastest for you?

Have been testing on a newly created Astro project.

The network condition fluctuates here, but I got some brief results that 16 is slow (~2 min), 48 takes ~30 sec, and 60 seems the best (~23 sec).

KieranP commented 1 week ago

@Jarred-Sumner Hmm, curious. Bun used to work fine for me. I only started seeing the issues after upgrading to Mac Sequoia. Does Sequoia handle connections differently that would have caused 256 connections to saturate the network?

KieranP commented 5 days ago

@Jarred-Sumner Something still not quite right here. Yarn takes 20s to resolve and download, so far bun has taken 2+ minutes and counting. So looks like the max http requests was not the whole solution.

chardoncs commented 5 days ago

I started doubting that it's an issue from proxies. This issue did not happen when I was using Bun on a virtual server in SF over ssh.

Also, I set the max request limit to 60 and it feels better (16 is kinda slow).