GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AbortSignal.any() of another composite leaks: an observed outer composite outlives all of its sources · Issue #66612 · nodejs/node

AbortSignal.any() of another composite leaks: an observed outer composite outlives all of its sources #66612

New issue
Copy link
New issue
Copy link
Closed
#66617
Closed
AbortSignal.any() of another composite leaks: an observed outer composite outlives all of its sources#66612
#66617
Copy link

Description

@rinarakaki
rinarakaki
opened on Oct 8, 2026
Issue body actions

Version

v26.10.0 and v26.11.1.

Platform

Linux arm64.

Subsystem

lib (abortcontroller)

What steps will reproduce the bug?

Run node --expose-gc repro.mjs:

// node --expose-gc e3.mjs
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const collect = async () => { for (let round = 0; round < 4; round++) { await sleep(10); globalThis.gc(); } };
for (const nested of [false, true]) {
  let sources = [];
  const handed = [];
  for (let i = 0; i < 8; i++) {
    (() => {
      const a = new AbortController();
      const b = new AbortController();
      sources.push(a, b);
      const composite = nested ? AbortSignal.any([a.signal, AbortSignal.any([b.signal])]) : AbortSignal.any([a.signal, b.signal]);
      const payload = new Uint8Array(2 ** 20);
      composite.addEventListener("abort", () => payload.fill(1));
      handed.push(new WeakRef(composite));
    })();
  }
  // While the sources live, nothing holds the inner composite, which a collection takes first.
  await collect();
  sources = undefined;
  await collect();
  console.log(`nested: ${nested}; ${handed.filter(ref => ref.deref() !== undefined).length}/8 composites alive once their sources were collected`);
}

How often does it reproduce? Is there a required condition?

Always: 5 of 5 runs on each version, when the inner composite is collected before its sources, as the repro arranges. If the order is left to the collector, it reproduces only sometimes.

What is the expected behavior? Why is that the expected behavior?

nested: true; 0/8 composites alive, the same as nested: false. Once every source of a composite is gone, nothing can abort it, so its listener, and what the listener holds, should go too.

What do you see instead?

nested: true; 8/8 composites alive: each outer composite, with its listener and the 1 MiB it holds, stays reachable for good.

Additional information

AbortSignal.any() follows an inner composite's sources directly. The outer composite's clean-up seems to be tied to the inner composite, so collecting the inner one first leaves the outer one in gcPersistentSignals with no source left to release it.

Activity

  1. nodejs-github-bot
    closed this as completedin #66617on Oct 12, 2026
  2. RomainLanz
    added a commit that references this issue on Oct 12, 2026

    lib: fix AbortSignal.any() nested composite leak

    1d3b65d
  3. richardlau
    added 3 commits that reference this issue on Oct 12, 2026

    lib: fix AbortSignal.any() nested composite leak

    444b2cd

    lib: fix AbortSignal.any() nested composite leak

    857da13

    lib: fix AbortSignal.any() nested composite leak

    447c36c
  4. aduh95
    added 2 commits that reference this issue on Oct 23, 2026

    lib: fix AbortSignal.any() nested composite leak

    c334c6c

    lib: fix AbortSignal.any() nested composite leak

    9affbed
  5. aduh95
    added a commit that references this issue on Nov 11, 2026

    lib: fix AbortSignal.any() nested composite leak

    992edab
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.