Commit ff17536
docs(snapshot): add V8 snapshot troubleshooting guide (#6010)
## Motivation
Building a V8 startup snapshot serializes the whole heap, so any
dependency that
opens a socket, starts a timer, or initializes a native binding at
module-evaluation time can make the blob fail to build — or build and
then crash
on restore. There was no guide for finding which module is responsible
or how to
fix it.
## What
New dedicated page `advanced/snapshot-troubleshooting.md` (EN + zh-CN):
- **The serializability rule** — what cannot survive the round-trip
(native
bindings / libuv handles / lazy web-global getters) and when a
dependency
trips it.
- **Failure surfaces** — build-time vs restore-time, with the exact
error
strings each emits (`killed by signal SIGSEGV`, `no blob was written`,
`Check failed: current == end_slot_index`, `Aop Advice not found`,
`Cannot find module`, …).
- **Find the offending module** — `NODE_DEBUG` namespaces, a clean
`NODE_OPTIONS`, `--dry-run`, `--skip-bundle` bisecting,
`--force-external`
confirmation.
- **Fixes** — `--force-external`, `egg.snapshot.lazyModules`, the
snapshot
lifecycle hooks, deferring work out of module scope, avoiding the web
globals.
- **Failure modes in detail** (tegg `@Advice` filePath, the
lazy-external member
proxy, runtime-asset `ENOENT`) and a configuration reference table.
Also documents the previously-undocumented `egg.snapshot.lazyModules`
config in
`advanced/snapshot.md`, cross-links the new page from it, and wires the
page into
the English and Chinese advanced sidebars.
Docs-only; no runtime code change. Builds on the snapshot feature
already on
`next` (#5998 / #5999 / #6001 / #6003).
## Test evidence
- `vitepress build site` passes clean — VitePress's dead-link/anchor
check is
green, so both new pages render and every cross-file and in-page anchor
resolves (the two detail headings use explicit ASCII `{#…}` ids because
the
VitePress slugifier retains CJK + fullwidth `「」`).
- Every technical claim was adversarially verified against the
`egg-bundler` / `egg-bin` / `egg-scripts` source — exact error strings,
flag
names, debug namespaces, and the default lazy-module set.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Added a new Snapshot Troubleshooting guide in English and Chinese,
covering common build and restore failure symptoms, how to diagnose
them, and recommended fixes.
* Expanded the Snapshot guide with guidance on configuring additional
lazy-loaded modules, plus clearer troubleshooting links.
* Updated the sidebar navigation to include the new troubleshooting page
in both languages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6900383 commit ff17536
5 files changed
Lines changed: 795 additions & 4 deletions
File tree
- site
- .vitepress
- docs
- advanced
- zh-CN/advanced
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
| |||
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
| 410 | + | |
409 | 411 | | |
410 | 412 | | |
411 | 413 | | |
| |||
0 commit comments