bun run build fails to complete
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:
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
runsc version release-20241217.0
spec: 1.1.0-rc.1docker version (if using docker)
Docker version 27.4.1, build b9d17eauname
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)
N/Arepo state (if built from source)
N/A
runsc debug logs (if available)
https://modal-public-assets.s3.us-east-1.amazonaws.com/vendor/bun-debug-logs.zipSource: google/gvisor