#11331·gvisor

bun run build fails to complete

Author: azliu0Created Dec 31, 2024Updated Sep 26, 2026
Labelstype: bugstale-issue

Description

bun run build fails to complete in gVisor with Next.js version 14.2.20.

There are already some known incompatibilities with Bun and gVisor. For example, Bun implements a workaround for the missing pidfd API in gVisor (https://github.com/google/gvisor/issues/5839). To try to address this incompatibility, I've partially implemented the api here: https://github.com/google/gvisor/compare/master...azliu0:gvisor:azliu/pidfd_open. This patch implements pidfd_open, which is the only syscall in the pidfd api used by bun; see here.

Unfortunately, even with this patch, the reproduction script below still fails, which leads me to believe that something else may be going on. I can't be sure that this is only a gVisor issue, so I've also opened https://github.com/oven-sh/bun/issues/16063. The reproduction script works with runc so it seems likely there's still something wrong with gVisor.

cc @pawalt

Steps to reproduce

Dockerfile:

bash
FROM oven/bun:latest

RUN apt-get update -yqq && \
    apt-get install -yqq git && \
    bun install -g turbo

WORKDIR /march
RUN git clone --depth 1 https://github.com/marchhq/march.git . && \
    git fetch --depth 1 origin c0f0d196c4f7f94e10a66747be9bf96ce0135967 && \
    git checkout -f FETCH_HEAD
RUN bun install
CMD ["bun", "run", "build"]

Then build the image and run with runsc.

Expected behavior: bun run build finishes relatively quickly. Observed behavior: bun run build hangs at the step Generating static pages (21/21).

On the patched version that implements pidfd_open, I also observe bun run build hanging after a certain point, but the output looks different. A caveat is that the implementation in this patch may be incorrect, but it at least passes the tests in test/syscalls/linux/pidfd.cc.

I observe the expected behavior with runc.

runsc version

bash
runsc version release-20241217.0
spec: 1.1.0-rc.1

docker version (if using docker)

bash
Docker version 27.4.1, build b9d17ea

uname

Linux ip-172-31-75-24 6.8.0-1018-aws #20-Ubuntu SMP Thu Oct 10 18:14:42 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

kubectl (if using Kubernetes)

bash
N/A

repo state (if built from source)

N/A

runsc debug logs (if available)

bash
https://modal-public-assets.s3.us-east-1.amazonaws.com/vendor/bun-debug-logs.zip