[Bug]: build stuck
System Info
System: OS: macOS 15.6.1 CPU: (10) arm64 Apple M1 Pro Memory: 229.77 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - /Users/edson.lin/.nvm/versions/node/v18.16.0/bin/node Yarn: 1.22.22 - /Users/edson.lin/.nvm/versions/node/v18.16.0/bin/yarn npm: 9.5.1 - /Users/edson.lin/.nvm/versions/node/v18.16.0/bin/npm pnpm: 10.20.0 - /Users/edson.lin/.nvm/versions/node/v18.16.0/bin/pnpm Browsers: Chrome: 142.0.7444.60 Safari: 18.6 npmPackages: @rspack/cli: ^1.6.0 => 1.6.0 @rspack/core: ^1.6.0 => 1.6.0 @rspack/plugin-react-refresh: ^1.5.2 => 1.5.2
Details
If a worker includes styles (sass-loader + modern-compiler + sass-embedded), it causes the build to hang and the CI never finishes.
Reproduce link
https://github.com/T9-Forever/rspack-stuck
Reproduce Steps
- Run npm run build
- see console
it's actually same issue as https://github.com/webpack/sass-loader/issues/1244 which behaves same as webpack + worker-loader, so the real problem is
- worker-loader doesn't call childCompiler.close()
- sass-loader use shutdown hooks which may not be called for child-compiler
So we may have following solutions
- call childCompiler.close in worker-loader so it can successfully call shutdown hooks
- sass-loader use done hooks which may be more accurate than shutdown hook
cc @alexander-akait, what's your suggestion?
@hardfist
call childCompiler.close in worker-loader so it can successfully call shutdown hooks
it is the right solution, but worker-loader is deprecated at all and should not be used, more likely doesn't have compatibility with webpack@5/rspack...
sass-loader use done hooks which may be more accurate than shutdown hook
shutdown is the place where we should shutdown everything - extra compilers, caches, active connections, etc, done is more about compilation was done, where you need to handle something from stats/reports/etc