oven-sh / bun

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

Segmentation fault in Ubuntu 22 Docker container #7538

Open dmytrotkk opened 10 months ago

dmytrotkk commented 10 months ago

What version of Bun is running?

1.0.15

What platform is your computer?

Linux 5.4.0-156-generic x86_64 x86_64

What steps can reproduce the bug?

Error is reproducible with this Dockerfile:

FROM ubuntu:jammy

RUN apt update && apt install -y --fix-missing unzip curl wget

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash
RUN apt-get install --no-install-recommends -y nodejs

RUN curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr bash -s "bun-v1.0.15"
RUN bun --version

RUN bun install ethers

COPY test.ts .
CMD bun run test.ts

test.ts file:

import { QuickNodeProvider } from 'ethers'
const provider = new QuickNodeProvider()
await provider.getBlockNumber()

NOTE: Reproducible only when running in Docker on Ubuntu host machine, not reproducible with OrbStack on M1 macOS, not reproducible when running on Ubuntu host machine without Docker.

What is the expected behavior?

test.ts should be executed without errors.

What do you see instead?

Segmentation fault (core dumped)

Additional information

Running bun build with target=bun doesn't help, while bun build with target=node fails with require is not a function error.

Jarred-Sumner commented 10 months ago

I spent some time digging into this

It's a Worker bug when an exception happens during the error handler

bogordesaincom commented 9 months ago

it still erorr on version v1.0.21

Segmentation fault (core dumped)
mjholub commented 8 months ago

Same issue here. Though it works on Artix as the host OS. I'm using Bun 1.0.25 and running 24.04. It also fails on OpenSUSE Leap 15. My Docker version info on Artix:

Client:
 Version:           25.0.0
 API version:       1.43 (downgraded from 1.44)
 Go version:        go1.21.6
 Git commit:        e758fe5
 Built:             Thu Jan 18 17:09:01 2024
 OS/Arch:           linux/amd64
 Context:           rootless

Server: Docker Engine - Community
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:05:28 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.6
  GitCommit:        091922f03c2762540fd057fba91260237ff86acb
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
 rootlesskit:
  Version:          1.1.0
  ApiVersion:       1.1.1
  NetworkDriver:    slirp4netns
  PortDriver:       builtin
  StateDir:         /tmp/rootlesskit3573586556
 slirp4netns:
  Version:          1.2.2
  GitCommit:        0ee2d87523e906518d34a6b423271e4826f71faf

On Alpine 3.19, where it doesn't work:

Client:
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.21.3
 Git commit:        afdd53b4e341be38d2056a42113b938559bb1d94
 Built:             Fri Oct 27 15:13:04 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.21.3
  Git commit:       311b9ff0aa93aa55880e1e5f8871c4fb69583426
  Built:            Fri Oct 27 15:13:04 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.10
  GitCommit:        4e1fe7492b9df85914c389d1f15a3ceedbb280ac
 runc:
  Version:          1.1.10
  GitCommit:        18a0cb0f32bcac2ecc9a10f327d282759c144dab
 docker-init:
  Version:          0.19.0
  GitCommit:
cedpoilly commented 8 months ago

Still present on 1.0.27, Ubuntu 20.04 LTS

AstralBaby commented 6 months ago

Same in macos m1