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

[Bug]: "Failed to get stats" HMR crash #9687

Open
RobHannay opened this issue Mar 13, 2025 · 1 comment
Open

[Bug]: "Failed to get stats" HMR crash #9687

RobHannay opened this issue Mar 13, 2025 · 1 comment
Assignees

Comments

@RobHannay
Copy link

Version

System:
    OS: macOS 15.3.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 78.00 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 134.0.6998.89
    Safari: 18.3.1
  npmPackages:
    @rsbuild/core: 1.2.18 => 1.2.18 
    @rsbuild/plugin-babel: 1.0.4 => 1.0.4 
    @rsbuild/plugin-css-minimizer: 1.0.2 => 1.0.2 
    @rsbuild/plugin-mdx: 1.0.2 => 1.0.2 
    @rsbuild/plugin-node-polyfill: 1.3.0 => 1.3.0 
    @rsbuild/plugin-react: 1.1.1 => 1.1.1 
    @rsbuild/plugin-type-check: 1.2.1 => 1.2.1

Details

I'm struggling to reliably reproduce, but wanted to highlight that it's still somehow trying to access stats that it can't find when doing HMR.

If you can't investigate further without a repro then feel free to close this issue. I will try and understand a pattern for it to occur

● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (98%) emitting emit                                                                                                                                                                                             Failed to get stats due to error: Unable to access compilation with id = CompilationId(1) now. The compilation have been removed on the Rust side. The latest compilation id is CompilationId(742), are you trying to access the stats from the previous compilation?
file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5275
        if (statsJson.entrypoints) for (let entrypoint of Object.values(statsJson.entrypoints)){
                      ^

TypeError: Cannot read properties of null (reading 'entrypoints')
    at SocketServer.sendStats (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5275:23)
    at SocketServer.onConnect (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5244:32)
    at WebSocketServer.<anonymous> (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5203:18)
    at WebSocketServer.emit (node:events:518:28)
    at file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5186:27
    at WebSocketServer.completeUpgrade (/Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/compiled/ws/index.js:2213:11)
    at WebSocketServer.handleUpgrade (/Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/compiled/ws/index.js:2150:16)
    at SocketServer.upgrade (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5185:58)
    at CompilerDevMiddleware.upgrade (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5491:27)
    at Object.onUpgrade (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:6150:57)
    at Http2SecureServer.onUpgrade (file:///Users/robhannay/web/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:6066:42)
    at Http2SecureServer.emit (node:events:518:28)
    at onParserExecuteCommon (node:_http_server:950:14)
    at onParserExecute (node:_http_server:852:3)

Node.js v22.14.0

Image

Followed up (from a child process I assume) with

Error: write EPIPE
    at target._send (node:internal/child_process:877:20)
    at target.send (node:internal/child_process:751:19)
    at /Users/robhannay/web/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:18:31
    at new Promise (<anonymous>)
    at sendMessage (/Users/robhannay/web/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:10:38)
    at process.handleMessage (/Users/robhannay/web/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:51:27) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Reproduce link

As I can't provide reliable repro steps, I can't necessarily make a minimal one

Reproduce Steps

  1. Run pnpm rsbuild dev
  2. Edit a file
  3. Sometimes, this error is thrown
@chenjiahan
Copy link
Member

The web-infra-dev/rsbuild#4784 should resolve the Cannot read properties of null (reading 'entrypoints') error.

For the Unable to access compilation with id warning, @SyMind is trying to fix it

@chenjiahan chenjiahan transferred this issue from web-infra-dev/rsbuild Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants