Skip to content

[BUG] Regression in @openfeature/[email protected]: unbounded memory growth with useBooleanFlagValue  #1360

@belaczek

Description

@belaczek

Observed behavior

After upgrading @openfeature/react-sdk from 1.2.0 to 1.2.1 (with @openfeature/web-sdk 1.7.3), memory usage grows continuously in a React page with many useBooleanFlagValue hooks and frequent re-renders.
In our app this leads to multi-GB RSS growth and eventual OOM/abort in browser automation runs.

Regression appears to come from commit e79c06a (react-sdk-v1.2.1), where ProviderEvents.Ready listener in attachHandlersAndResolve became unconditional.

Expected Behavior

useBooleanFlagValue should not cause unbounded memory growth or repeated Ready-driven re-evaluations when provider is already READY.
Steady-state re-renders should keep memory roughly stable.

Steps to reproduce

  1. Create a React app with:
  2. Render many components (e.g. 200-1000) each calling useBooleanFlagValue(...).
  3. Trigger frequent parent re-renders (e.g. timer/state updates or list interactions/navigation loops).
  4. Record heap/RSS over time.
  5. Repeat same repro with @openfeature/[email protected].

Result:

  • 1.2.1: memory grows steadily (can reach OOM in heavy scenarios).
  • 1.2.0: memory remains stable.

Notes:

  • The key delta is in attachHandlersAndResolve:
    • 1.2.0: register Ready handler only if status is NOT_READY.
    • 1.2.1: always register Ready handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions