Skip to content

Prevent abort listener leaks in async client requests - #1597

Merged
minggangw merged 2 commits into
RobotWebTools:developfrom
minggangw:fix-1596
Sep 10, 2026
Merged

Prevent abort listener leaks in async client requests#1597
minggangw merged 2 commits into
RobotWebTools:developfrom
minggangw:fix-1596

Conversation

@minggangw

@minggangw minggangw commented Sep 10, 2026

Copy link
Copy Markdown
Member

This PR tightens Client.sendRequestAsync() resource cleanup by ensuring abort/timeout listeners are removed in all completion paths (success, abort, timeout, and synchronous failures), preventing listener accumulation across repeated async requests.

Changes:

  • Add explicit cleanup of abort/timeout listeners in sendRequestAsync() via shared cleanup() + named handlers.
  • Add tests that assert abort/timeout listeners are fully released after each request outcome (including pre-aborted signals and send/serialization failures).

Fix: #1596

Copilot AI lite review requested due to automatic review settings September 10, 2026 07:25
@minggangw minggangw changed the title Fix 1596 Prevent abort listener leaks in async client requests Sep 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is small, targeted, and backed by new tests that verify listener cleanup across the relevant success and failure paths.

Pull request overview

This PR tightens Client.sendRequestAsync() resource cleanup by ensuring abort/timeout listeners are removed in all completion paths (success, abort, timeout, and synchronous failures), preventing listener accumulation across repeated async requests.

Changes:

  • Add explicit cleanup of abort/timeout listeners in sendRequestAsync() via shared cleanup() + named handlers.
  • Add tests that assert abort/timeout listeners are fully released after each request outcome (including pre-aborted signals and send/serialization failures).
File summaries
File Description
lib/client.js Ensures abort/timeout listeners are consistently removed on resolve/reject to avoid listener leaks.
test/test-client.js Adds coverage asserting listener cleanup across success, abort, timeout, and error scenarios.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 90.831% (+0.02%) from 90.812% — minggangw:fix-1596 into RobotWebTools:develop

@minggangw
minggangw merged commit 92e042c into RobotWebTools:develop Sep 10, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up async client abort listeners

3 participants