oven-sh / bun

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

`bun install` causing segfaults on Vercel #9640

Open ricardonunez-io opened 4 months ago

ricardonunez-io commented 4 months ago

What version of Bun is running?

1.0.35

What platform is your computer?

Linux 5.10.174 x86_64 x86_64 on Vercel; macOS Sonoma 14.4 locally

What steps can reproduce the bug?

Here's the bun.lockb.zip file (zipped because GitHub doesn't support lockb files directly), and the package.json below.

{
  "name": "application",
  "type": "module",
  "scripts": {
    "dev": "vinxi dev",
    "build": "vinxi build",
    "start": "vinxi start"
  },
  "dependencies": {
    "@capacitor/android": "latest",
    "@capacitor/core": "latest",
    "@capacitor/ios": "latest",
    "@gitlab/fonts": "latest",
    "@kobalte/core": "latest",
    "@solidjs/router": "latest",
    "@solidjs/start": "latest",
    "@tanstack/solid-query": "^5.28.8",
    "autoprefixer": "latest",
    "chart.js": "latest",
    "chartjs-plugin-datalabels": "latest",
    "date-fns": "latest",
    "postcss": "latest",
    "solid-js": "latest",
    "solid-toast": "latest",
    "solidjs-use": "latest",
    "tailwindcss": "latest",
    "vinxi": "latest",
    "vite-plugin-commonjs": "^0.10.1"
  },
  "engines": {
    "node": "20.x"
  },
  "devDependencies": {
    "@rollup/plugin-node-resolve": "^15.2.3",
    "@rollup/plugin-commonjs": "^25.0.7",
    "esbuild": "latest",
    "@capacitor/cli": "latest",
    "solid-devtools": "latest",
    "typescript": "latest",
    "vite": "latest",
    "vite-plugin-solid": "latest"
  }
}

I use latest for all package versions, and deployed once last night ~10 hours ago, and once 30 minutes ago. After redeploying, I ran into segmentation faults related to running bun i, even after installing the latest canary version in the install script.

Upgrading to canary did not work, but deleting the lockfile did, and re-adding the lockfile to Git and then deploying again worked, as well. Seems like package discrepancy caused the issue, though I'm not sure exactly how to reproduce it.

What is the expected behavior?

Successful bun i run, i.e.

bun install v1.0.32 (5fec71bd)
Checked 666 installs across 716 packages (no changes) [57.00ms]

when cached, or:

bun install v1.0.35 (fa145b22)
 + @capacitor/cli@5.7.4
 + @rollup/plugin-commonjs@25.0.7
 + @rollup/plugin-node-resolve@15.2.3
 + esbuild@0.20.2
 + solid-devtools@0.29.3
 + typescript@5.4.3
 + vite@5.2.6
 + vite-plugin-solid@2.10.2
 + @capacitor/android@5.7.4
 + @capacitor/core@5.7.4
 + @capacitor/ios@5.7.4
 + @gitlab/fonts@1.3.0
 + @kobalte/core@0.12.6
 + @solidjs/router@0.13.1
 + @solidjs/start@1.0.0-rc.0
 + @tanstack/solid-query@5.28.8
 + autoprefixer@10.4.19
 + chart.js@4.4.2
 + chartjs-plugin-datalabels@2.2.0
 + date-fns@3.6.0
 + postcss@8.4.38
 + solid-js@1.8.16
 + solid-toast@0.5.0
 + solidjs-use@2.3.0
 + tailwindcss@3.4.1
 + vinxi@0.3.11
 + vite-plugin-commonjs@0.10.1
 622 packages installed [1.94s]

When not cached

What do you see instead?

Instead, I see the following logs from Vercel, ending in a SIGSEGV

[11:07:15.945] Running build in Washington, D.C., USA (East) – iad1
[11:07:17.098] Cloning github.com/******* (Branch: main, Commit: *******)
[11:07:18.090] Cloning completed: 990.754ms
[11:07:22.726] Restored build cache
[11:07:22.885] Running "vercel build"
[11:07:24.115] Vercel CLI 33.6.1
[11:07:25.977] Running "install" command: `bun upgrade --canary && bun i`...
[11:07:26.544] Downloading... 
[11:07:28.083] [2.01s] Upgraded.
[11:07:28.083] 
[11:07:28.083] Welcome to Bun's latest canary build!
[11:07:28.084] 
[11:07:28.084] Report any bugs:
[11:07:28.084] 
[11:07:28.084]     https://github.com/oven-sh/bun/issues
[11:07:28.084] 
[11:07:28.084] Changelog:
[11:07:28.084] 
[11:07:28.084]     https://github.com/oven-sh/bun/compare/940448d6b688faec123c6939e8117365625fa750...main
[11:07:28.116] bun install v1.0.35 (fa145b22)
[11:07:53.162] Error: Command "bun upgrade --canary && bun i" exited with SIGSEGV

Additional information

Thank you!

subodhpareek18 commented 4 months ago

I started having the same issue today, it was fine until yesterday.

Here is my package.json

{
  "name": "...",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "db:push": "drizzle-kit push:sqlite",
    "db:studio": "drizzle-kit studio",
    "tsc": "tsc --watch --project ./tsconfig.json",
    "shadcn": "bunx shadcn-ui@latest"
  },
  "dependencies": {
    "@libsql/client": "^0.5.6",
    "@paralleldrive/cuid2": "^2.2.2",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-slot": "^1.0.2",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.0",
    "drizzle-orm": "^0.30.5",
    "drizzle-zod": "^0.5.1",
    "next": "14.1.4",
    "react": "^18",
    "react-dom": "^18",
    "tailwind-merge": "^2.2.2",
    "tailwindcss-animate": "^1.0.7"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "drizzle-kit": "^0.20.14",
    "eslint": "^8",
    "eslint-config-next": "14.1.4",
    "postcss": "^8",
    "prettier": "^3.2.5",
    "prettier-plugin-tailwindcss": "^0.5.12",
    "tailwindcss": "^3.3.0",
    "typescript": "^5"
  }
}
Jarred-Sumner commented 4 months ago

@dylan-conway and I both spent some time investigating and haven’t figured this out yet. @subodhpareek18 can you try clearing the Vercel build cache and redeploying?

subodhpareek18 commented 4 months ago

@Jarred-Sumner I tried redeploying first with existing build cache and it failed in the same way, then I tried without existing build cache and it succeeded.

This commit included some new dependencies btw like libsql, drizzle, etc.

I've also tried making commits that only include a code change and no new deps. But for some reasons they are currently stuck in "queued" status, something could be wrong with vercel there, will update if they get unstuck and generally on future commits.

subodhpareek18 commented 4 months ago

I tried multiple new commits that had no new deps and only code changes, they all deployed successfully. I also tried one new commit with trpc/zod related new deps and that got built successfully too.

So the issue was not replicated on further attempts after the initial one.