oven-sh / bun

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

`bun install` segfault within docker on macos #12267

Closed mik3y closed 3 months ago

mik3y commented 3 months ago

How can we reproduce the crash?

Docker build on macos stalls (appears like a hang, but is printing status) on "waiting for X tasks". Then eventually segfaults.

Dockerfile:

FROM oven/bun:1 AS jsbuild

RUN mkdir /app
WORKDIR /app

COPY package.json bun.lockb /app/
RUN bun install --frozen-lockfile --no-cache --verbose --concurrent-scripts=1

package.json:

{
  "name": "example",
  "version": "1.0.0",
  "license": "UNLICENSED",
  "private": true,
  "targets": {
    "app": {
      "distDir": "dist/app",
      "publicUrl": "/static/app"
    }
  },
  "source": "js/index.html",
  "browserslist": "> 0.5%, last 2 versions, not dead",
  "dependencies": {
    "bootstrap": "^5.3.3",
    "dayjs": "^1.11.11",
    "leaflet": "^1.9.4",
    "lodash-es": "^4.17.21",
    "react": "^18.3.1",
    "react-bootstrap": "^2.10.4",
    "react-bootstrap-typeahead": "^6.3.2",
    "react-country-flag": "^3.1.0",
    "react-dom": "^18.3.1",
    "react-leaflet": "^4.2.1",
    "react-router": "^6.24.0",
    "react-router-bootstrap": "^0.26.3",
    "react-router-dom": "^6.24.0",
    "react-timeago": "^7.2.0"
  },
  "devDependencies": {
    "@biomejs/biome": "^1.8.3",
    "@types/bun": "^1.1.6",
    "@types/react": "^18.3.3",
    "@types/react-dom": "^18.3.0",
    "@vitejs/plugin-legacy": "^5.4.1",
    "@vitejs/plugin-react": "^4.3.1",
    "process": "^0.11.10",
    "vite": "^5.3.2",
    "vite-tsconfig-paths": "^4.3.2"
  },
  "module": "index.ts",
  "type": "module",
  "peerDependencies": {
    "typescript": "^5.5.2"
  }
}

Relevant log output

$ docker build -t example --progress plain .                             
[...]
#9 79.08 [PackageManager] waiting for 62 tasks
#9 79.08     [59.40ms]Downloaded @types/warning tarball
#9 79.09 [@types/warning] Start extracting .d7ffdef77ef23bfc-000000D3.warning
#9 79.09  LICENSE
#9 79.09  README.md
#9 79.09  index.d.ts
#9 79.09  package.json
#9 79.09 [@types/warning] Extracted
#9 79.09 [PackageManager] waiting for 62 tasks
#9 79.22 [PackageManager] waiting for 61 tasks
#9 80.22 [PackageManager] waiting for 61 tasks
[ ... ]
#9 361.2 [PackageManager] waiting for 61 tasks
#9 362.2 [PackageManager] waiting for 61 tasks
#9 363.2 [PackageManager] waiting for 61 tasks
#9 363.8 ============================================================
#9 363.8 Bun v1.1.17 (bb66bba1) Linux arm64
#9 363.8 Linux Kernel v5.10.104 | glibc v2.31
#9 363.8 Args: "bun" "install" "--frozen-lockfile" "--no-cache" "--verbose" "--concurrent-scripts=1"
#9 363.8 Features: extracted_packages(211) 
#9 363.8 Elapsed: 363630ms | User: 840ms | Sys: 1435ms
#9 363.8 RSS: 0.69GB | Peak: 0.16GB | Commit: 0.69GB | Faults: 0
#9 363.8 
#9 363.8 panic: Segmentation fault at address 0xB0
#9 363.8 oh no: Bun has crashed. This indicates a bug in Bun, not your code.
#9 363.8 
#9 363.8 To send a redacted crash report to Bun's team,
#9 363.8 please file a GitHub issue using the link below:
#9 363.8 
#9 363.8  https://bun.report/1.1.17/Li1bb66bbaAggB+7Dm3nwrDm3nwrD+6/wrDm461pD2x9h8Dm5xh8D2555nD2/z39Cuk7BA2AgL
#9 363.8 
#9 364.0 Trace/breakpoint trap
#9 ERROR: executor failed running [/bin/sh -c bun install --frozen-lockfile --no-cache --verbose --concurrent-scripts=1]: exit code: 133
------
 > [jsbuild 5/8] RUN bun install --frozen-lockfile --no-cache --verbose --concurrent-scripts=1:
------
executor failed running [/bin/sh -c bun install --frozen-lockfile --no-cache --verbose --concurrent-scripts=1]: exit code: 133


### Stack Trace (bun.report)

Bun v1.1.17 ([`bb66bba`](<https://github.com/oven-sh/bun/tree/bb66bba1bf6d57983e7efef7ab706bce12137028>)) on linux aarch64 [InstallCommand]

Segmentation fault at address 0x000000B0

- [`buffer.rs:116`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/io/buffered/bufreader/buffer.rs#L116>): `??`
- [`http.zig:3000`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/http.zig#L3000>): `src.http.closeAndFail__anon_139741`
- [`http.zig:3000`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/http.zig#L3000>): `src.http.closeAndFail__anon_139741`
- [`http.zig:1140`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/http.zig#L1140>): `src.deps.uws.NewSocketHandler`
- [`socket.c:199`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/socket.c#L199>): `us_socket_close`
- [`openssl.c:272`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/crypto/openssl.c#L272>): `ssl_on_end`
- [`loop.c:418`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/loop.c#L418>): `us_loop_run_bun_tick`
- [`uws.zig:1283`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/deps/uws.zig#L1283>): `src.http.HTTPThread.processEvents`
- [`http.zig:815`](<https://github.com/oven-sh/bun/blob/bb66bba1bf6d57983e7efef7ab706bce12137028/src/http.zig#L815>): `Thread.PosixThreadImpl.spawn__anon_82709.Instance.entryFn`
- `??`

<!-- from bun.report: -th_XmcKZuQw6QW9sRG7 -->
mik3y commented 3 months ago

Updated docker mac from [lost old version number - probably 3-6mo old] to latest, now cannot reproduce. Will close this one for the sake of the maintainers & reopen if reproducible.