Skip to content

[Bug]: Deadlock when starting multiple Rsbuild dev servers #9538

@andreasgerstmayr

Description

@andreasgerstmayr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions