From 037755ba161dd0d0c4b2bf1f295474da7bdc0d2b Mon Sep 17 00:00:00 2001 From: Bilal Godil Date: Wed, 15 Apr 2026 16:53:07 -0700 Subject: [PATCH] retry tsdown migration build to survive qemu-user futex hangs Cross-arch arm64-on-amd64 docker buildx runs the rolldown-backed tsdown build under qemu-user, whose futex emulation occasionally deadlocks the worker threads. Wrap the call in a bounded timeout + 3-attempt retry so a hang fails the layer in <11min and recovers on the next try. --- docker/local-emulator/Dockerfile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/local-emulator/Dockerfile b/docker/local-emulator/Dockerfile index 138270b40..603999b64 100644 --- a/docker/local-emulator/Dockerfile +++ b/docker/local-emulator/Dockerfile @@ -57,8 +57,22 @@ ENV NEXT_PUBLIC_STACK_STRIPE_PUBLISHABLE_KEY=pk_test_mock_publishable_key_for_lo # Build the backend NextJS app RUN pnpm turbo run docker-build --filter=@stackframe/backend... --filter=@stackframe/dashboard... -# Build the self-host seed script -RUN cd apps/backend && pnpm build-self-host-migration-script +# Build the self-host seed script. +# tsdown -> rolldown is multi-threaded Rust; under qemu-user (cross-arch +# arm64-on-amd64) its futex emulation occasionally deadlocks and the build +# hangs forever. Bound each attempt and retry to ride out the race. +RUN cd apps/backend && \ + attempt=1; \ + while :; do \ + timeout --kill-after=30s 600s pnpm build-self-host-migration-script && break; \ + rc=$?; \ + if [ "$attempt" -ge 3 ]; then \ + echo "build-self-host-migration-script failed after $attempt attempts (last rc=$rc)" >&2; \ + exit "$rc"; \ + fi; \ + echo "build-self-host-migration-script attempt $attempt failed (rc=$rc); retrying..." >&2; \ + attempt=$((attempt + 1)); \ + done # Prune node_modules for runtime: remove dev tools, heavy UI packages,