Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Container init deadlock with cyclic remotes

Open
#5,196 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Noyabronok is already working on this.

Since Oct 13, 2026.

  • #5197 by @Noyabronok — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, typescript, webpack

Research direction

Start by tracing initializeSharing in the webpack-bundler-runtime and compare how its pending init promise interacts with the initScope cycle guard. Use the linked reproduction at https://github.com/Noyabronok/mf2-init-deadlock-repro (npm install, then npm start) to reproduce the hang; the README trace and DEBUG=1 npm start identify the init sequence. Done means both imports settle for the cyclic remotes with the default version-first strategy, with regression tests covering the deadlock.

Written by the indexing model from the issue text.

Description

Describe the bug

Two remotes that list each other as remotes and declare a shared entry can deadlock during container init in @module-federation/enhanced (tested with the latest 2.9.2 on webpack). If a host imports both while the first remote's init is still loading the second remote's entry, both import()s stay pending forever and no error is thrown.

It happens with the default version-first strategy on the remotes, and sharing react deadlocks the same way. Setting shareStrategy: 'loaded-first' on both remotes avoids it.

The cause is in webpack-bundler-runtime's initializeSharing. It returns a container's pending init promise to any caller, and the initScope cycle guard only sees the caller's own chain. When the host's chain and a remote's chain each enter one of the two containers, each waits on the other's pending promise and neither settles.

I'll open a PR with this fix and tests.

Reproduction

https://github.com/Noyabronok/mf2-init-deadlock-repro

npm install
npm start

http://localhost:3000/?gap=100 hangs (both imports log still pending after 5s: DEADLOCK), http://localhost:3000/?gap=2000 resolves. DEBUG=1 npm start adds a debug plugin that logs each container init, and the README has the full trace.

Used Package Manager

npm

System Info
  System:
    OS: macOS 26.6.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 84.50 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.21.0
    npm: 11.19.0
  Browsers:
    Chrome: 155.0.8059.40
  npmPackages:
    @module-federation/enhanced: 2.9.2
    webpack: 5.110.3
    webpack-cli: 7.2.3
Validations
  • Read the docs.
  • Read the common issues list.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a Module federation issue and not a framework-specific issue.
  • The provided reproduction is a minimal reproducible example of the bug.
Dominant language
JavaScript
Stars
2.7k
Forks
441
Avg merge
4d 6h
Merged PRs (30d)
32

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from module-federation/core

All issues in module-federation/core

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.