Open Brawl345 opened 2 years ago
Check if the build segfaults, this might be the same issue as https://github.com/preactjs/wmr/issues/893
No segfault, but I'm on Windows.
C:\Users\xyz\Downloads\example>npm run build
> build
> wmr build --prerender
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Wrote 23Kb to disk:
dist\index.html 460b
dist\index.d5d2e732.js 17Kb
dist\assets/style.e6ee4bcf.css 499b
dist\chunks/prerender.ea3dab95.js 4.8Kb
dist\chunks/index.fb97a71f.js 214b
I experience a random segmentation fault on MacOS during WMR build (prerender) with Node version 16.13.1
. Same symptom as the original poster of this issue #896 (Windows user, no segfault visible in the console).
This appears to be the same problem reported in #893
Update: in addition to segfault fatal exit codes, I am also getting graceful exit codes but the pre-rendering pass just stops without handing over to my post-build process. Very strange bug, which occurs frequently locally on my dev computer (MacOS), as well as CloudFlare Pages builder, and GitHub Actions CI. Could this have anything to do with Preact WMR's NodeJS Worker used to invoke the prerender script?
@danielweck yes, I think this is related to our use of worker_threads
. I'm thinking it may be the Node/glibc bug described here.
What type of Nodejs installation are you using on MacOS? I notice this started when I updated to 16.13.1, but I'm not sure if the brew/nvm binaries have the same issue (perhaps they're linked against different versions of glibc?).
Thanks Jason.
node --version
=> v16.13.2
Installed on MacOS via https://nodejs.org
Ah Ah, I am using this package.json
script for my CI builds now:
"build-try-again-if-fail": "(npm run build || npm run build || npm run build || npm run build || npm run build || npm run build || npm run build || npm run build || npm run build || npm run build || exit 0) || echo OK"
Ugly, but "60% of the time, it works every time" 👍
I've reproduced build failures for a default project npm init wmr
on the following platforms:
Running the build 100 times on the following versions fails n times: | Version | Failures |
---|---|---|
16.5.0 | 0,0 | |
16.6.0 | 0,0,0 | |
16.7.0 | 0,2 | |
16.8.0 | 2,2 | |
16.9.0 | 9 | |
16.10.0 | 2,7,9,1 | |
16.11.0 | 16,31,11,16,12 | |
16.13.1 | 16,20 |
Running build 10_000 times on the following versions fails n times:
Version | Failures |
---|---|
16.5.0 | 0 |
16.6.0 | 3 |
16.13.1 | 3287 |
17.0.0 | 0 |
I ran the build twice for 16.5.0.
docker:16 images use debian buster and this glibc:
GNU C Library (Debian GLIBC 2.28-10) stable release version 2.28.
I've also reproduced this on node:16-bullseye-slim
GNU C Library (Debian GLIBC 2.31-13+deb11u2) stable release version 2.31.
For what it's worth I can no longer reproduce the segfaults. Whatever bug in Node was causing them seems to be resolved?
Personally on Node v16.16.0
Can confirm on Node v16.17.0 on Windows 10 x64:
> npm run build
> build
> wmr build --prerender
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Wrote 27Kb to disk:
dist\index.html 460b
dist\index.883c8e44.js 18Kb
dist\assets/style.e6ee4bcf.css 499b
dist\chunks/prerender.ef8ef4be.js 7.7Kb
dist\chunks/index.7fb9d5bb.js 214b
Prerendered 3 pages:
/
/about [from /]
/error [from /]
I've ran the CI a few times in the past few days too, haven't ran into it.
I'm going to tentatively say this is resolved and close it out. If anyone runs into issues feel free to reply and we can reopen.
Hello, running into the same problem maybe
On a fresh new project on a windows machine.
$ npm --version
8.19.2
$ node --version
v19.0.0
$ npm run build --prerender
> build
> wmr build --prerender
Wrote 27Kb to disk:
dist\index.html 460b
dist\index.4b7b983c.js 18Kb
dist\assets/style.e6ee4bcf.css 499b
dist\chunks/prerender.6b2475ca.js 8.1Kb
dist\chunks/index.0e61ca1c.js 214b
/path_to_node_js_/npm: line 44: 1746 Segmentation fault "$NODE_EXE" "$NPM_CLI_JS" "$@"
@PodaruDragos Indeed, unfortunately we've noticed this too.
Describe the bug When running prerender on Node 16, the pages don't get prerendered.
To Reproduce Steps to reproduce the behavior:
npm init wmr example && cd example
npm run build
(which in turn runswmr build --prerender
)Expected behavior The page should get prerendered and the resulting HTML should contain everything. This is the build output:
This is the resulting
dist/index.html
:Now the same on Node 14:
You can see that it prerenders. The resulting
index.html
is correct:Bug occurs with:
wmr
orwmr start
(development)wmr build
(production)wmr serve
Desktop (please complete the following information):
Additional context N/A