Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next dev and next build crashing in next@>=14.2.1-canary.4 on Linux #64468

Closed
steve-marmalade opened this issue Apr 14, 2024 · 11 comments · Fixed by #64493
Closed

next dev and next build crashing in next@>=14.2.1-canary.4 on Linux #64468

steve-marmalade opened this issue Apr 14, 2024 · 11 comments · Fixed by #64493
Labels
bug Issue was opened via the bug report template. locked

Comments

@steve-marmalade
Copy link

steve-marmalade commented Apr 14, 2024

Link to the code that reproduces this issue

https://github.com/marmalade-labs/canary-crash

To Reproduce

Run any of the following (possibly only affects Linux):

  • pnpm dev
  • pnpm run build
  • Deploy to Vercel

Current vs. Expected behavior

pnpm dev

➜  canary-crash git:(main) pnpm dev

> [email protected] dev /home/stevie/code/canary-crash
> next dev

  ▲ Next.js 14.2.1-canary.4
  - Local:        http://localhost:3000

 ✓ Starting...
➜  canary-crash git:(main) 
➜  canary-crash git:(main) echo $?
0
➜  canary-crash git:(main) 

pnpm build

➜  canary-crash git:(main) pnpm run build -d

> [email protected] build /home/steve/code/canary-crash
> next build "-d"

  ▲ Next.js 14.2.1-canary.4

   Creating an optimized production build ...
➜  canary-crash git:(main) 
➜  canary-crash git:(main) echo $?
0

Deploy to Vercel (with Node v 18)

  ▲ Next.js 14.2.1-canary.4
   Creating an optimized production build ...
 ⚠ Attempted to load @next/swc-linux-x64-gnu, but an error occurred: /vercel/path0/node_modules/.pnpm/@[email protected]/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node: ELF load command past end of file
 ⚠ Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
 ⨯ Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
> Build error occurred
Error: Jest worker encountered 1 child process exceptions, exceeding retry limit
    at ChildProcessWorker.initialize (/vercel/path0/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
    at ChildProcessWorker._onExit (/vercel/path0/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
    at ChildProcess.emit (node:events:529:35)
    at ChildProcess._handle.onexit (node:internal/child_process:292:12) {
  type: 'WorkerError'
}
 ELIFECYCLE  Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu, 11 Apr 2024 01:47:33 +0000
  Available memory (MB): 31886
  Available CPU cores: 8
Binaries:
  Node: 18.18.2
  npm: 10.5.2
  Yarn: 1.22.22
  pnpm: 8.15.5
Relevant Packages:
  next: 14.2.1-canary.4 // Latest available version is detected (14.2.1-canary.4).
  eslint-config-next: 14.2.1-canary.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, App Router, Operating System (Windows, MacOS, Linux)

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), Vercel (Deployed)

Additional context

This may be a Linux-only issue, since @ztanner was not able to reproduce, per #64432 (comment)

One possible clue is that https://www.npmjs.com/package/@next/swc-linux-x64-gnu/v/14.2.1-canary.4 has an unpacked size of 88.2 MB whereas https://www.npmjs.com/package/@next/swc-linux-x64-gnu/v/14.2.1-canary.3 has an unpacked size of 131 MB. So maybe there was an issue generating this linux build artifact in the latest canary?

@vordgi
Copy link
Contributor

vordgi commented Apr 14, 2024

Same thing. Ubuntu (Github workflow):

image

On Windows it works with no problems

@steve-marmalade steve-marmalade changed the title next dev and next build crashing in v14.2.1-canary.4 on Linux next dev and next build crashing in next@>=14.2.1-canary.4 on Linux Apr 15, 2024
@steve-marmalade
Copy link
Author

Confirmed that this is still an issue in 14.2.1-canary.5.

FWIW https://www.npmjs.com/package/@next/swc-linux-x64-gnu/v/14.2.1-canary.5 is also 88MB, so that theory still stands (although it now seems unlikely it was due to a flaky build).

@mwskwong
Copy link

mwskwong commented Apr 15, 2024

Same thing. Ubuntu (Github workflow):

image

On Windows it works with no problems

I tried it on both Windows and Mac and it works normally when I build the same project on both OS, but as soon as I deploy to Vercel, which is using Linux, I either get a pretty generic error:

Error: No serverless pages were built

Or sometimes a more specific one:

 ⚠ Attempted to load @next/swc-linux-x64-gnu, but an error occurred: /vercel/path0/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node: ELF load command past end of file
 ⚠ Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
 ⨯ Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
> Build error occurred
Error: Jest worker encountered 1 child process exceptions, exceeding retry limit
    at ChildProcessWorker.initialize (/vercel/path0/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
    at ChildProcessWorker._onExit (/vercel/path0/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
    at ChildProcess.emit (node:events:529:35)
    at ChildProcess._handle.onexit (node:internal/child_process:292:12) {
  type: 'WorkerError'
}
Error: Command "npm run build" exited with 1

It is not reproducible as soon as I roll back to 14.2.1-canary.3. So perhaps the binary of SWC for Linux is missing from the build?

@franky47
Copy link
Contributor

franky47 commented Apr 15, 2024

Same issue in nuqs, next build started failing with 14.2.1-canary.4, and still does with 14.2.1-canary.5. 14.2.1-canary.3 passes fine.

The worst part of this is that Turborepo caches the failed output (because of the exit code 0), so retries will use the failed cache.

@typeofweb
Copy link
Contributor

Same issue on Vercel:
Error: Command "pnpm run build" exited with SIGBUS

@faresharmali
Copy link

faresharmali commented Apr 15, 2024

Having the same issue with vercel (i'm still on next version 12.2.1)

image

timneutkens pushed a commit that referenced this issue Apr 15, 2024
### What?

There is a race condition in the `pull-build-cache` script. When the
remote cache entry was removed between the dry run and the real run, it
will run the command and caches whatever is in the native folder.

Seems like there are some very old leftover files there which lead to an
broken publish.

This changes the command to fail when there are no files and empties the
folder before running the script. This should lead to pull-build-cache
to failing instead.

Closes PACK-2957
Fixes #64468
@timneutkens
Copy link
Member

Landed #64493 and triggered a new canary release. Will monitor when it's published.

@franky47
Copy link
Contributor

franky47 commented Apr 15, 2024

@timneutkens I can confirm 14.2.1-canary.6 fixed the build issue, thanks!

https://github.com/47ng/nuqs/actions/runs/8688135747

@steve-marmalade
Copy link
Author

Awesome, thanks @timneutkens

@Thinkscape
Copy link

Confirming 14.2.1-canary.5 was crashing, 14.2.1-canary.6 builds on Vercel a-ok 👍

ztanner pushed a commit that referenced this issue Apr 17, 2024
### What?

There is a race condition in the `pull-build-cache` script. When the
remote cache entry was removed between the dry run and the real run, it
will run the command and caches whatever is in the native folder.

Seems like there are some very old leftover files there which lead to an
broken publish.

This changes the command to fail when there are no files and empties the
folder before running the script. This should lead to pull-build-cache
to failing instead.

Closes PACK-2957
Fixes #64468
Copy link
Contributor

github-actions bot commented May 1, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label May 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants