Skip to content

Hot runtime: an un-awaited async act() never closes; the one-worker check waits for it anyway and names the wrong cause #812

Open

Description

@danfry1

In a one-worker hot run, a file that calls void act(async () => { … }) and never awaits it leaves React's act scope open for every later file on the worker. The next file waits up to the test timeout (5 s by default), then fails with HOT_RESIDENT_UNUSABLE.

This is a real leak, and the check is right to refuse the file. React 18 and 19 close an async act() scope (popActScope) only inside the then of the thenable act() returns (react/cjs/react.development.js, exports.act). An un-awaited call never runs that then. Instrumented on React 19.3.1, the callback's timer fired and the callback finished at 1.5 s, but the scope never closed. With .then() attached and nothing else changed, it closed at 1.5 s and the next file ran normally. Under Jest and per-file isolation the next file gets a fresh React, so nothing carries over. With freshRuntime, or with two or more workers (the pool retires the worker), the next file is unaffected.

What could be better:

Proposed: name both causes in the HOT_RESIDENT_UNUSABLE message and the troubleshooting entry ("an act() that was not awaited never closes; await it"). Separately, consider whether the check can tell a scope whose callback has settled (which will never close) from one still pending, and skip the wait for the former.

Activity

  1. added this to the 0.16.0 milestone on Nov 14, 2026
  2. added
    enhancement
    area:hot-runtime
    priority:low
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hot-runtimeenhancementpriority:low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions