rspack: [Bug]: Deadlock when starting multiple Rsbuild dev servers

Version

System:
  OS: Linux 6.12 Fedora Linux 41 (Workstation Edition)
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
  Memory: 41.28 GB / 62.49 GB
  Container: Yes
  Shell: 5.9 - /usr/bin/zsh
npmPackages:
  @rsbuild/core: ^1.1.10 => 1.2.3 
  @rsbuild/plugin-react: ^1.1.0 => 1.1.0

Details

I’m trying to start multiple Rsbuild dev servers in a custom express server, as described here: https://rsbuild.dev/api/javascript-api/dev-server-api#integrate-with-custom-server. However, when I try to start all dev servers at the same time, the process is stuck and the server does not respond to requests.

If I add a sleep (await new Promise(r => setTimeout(r, 5000));) between starting the dev servers, it works for a while. At some point (maybe if two dev servers compile at the same time?) it also stops working, the server stops responding.

I assume there is some deadlock or global state here, but I don’t know where to start looking. Any ideas?

The use case is that we have a repository with multiple module federation producer (every plugin of our software is a producer), and I’d like to start all of them in the same process, instead of firing up 15 dev servers, each allocating a separate port.

Reproduce link

https://github.com/andreasgerstmayr/perses-plugins

Reproduce Steps

  1. run npm i
  2. run npm run dev
  3. http://localhost:3005/plugins/BarChart/mf-manifest.json is not accessible

If you uncomment the workaround in scripts/devserver/devserver.ts, it works more or less. Sometimes it also gets stuck and the server stops responding to HTTP requests.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

We have identified the issue as a deadlock caused by Rspack stats.toJson. We will discuss how to address this issue as soon as possible.