Skip to content

fix(requester-node-http): remove listeners after request settles - #1612

Closed
Steve0x2a wants to merge 1 commit into
algolia:mainfrom
Steve0x2a:fix/node-http-requester-remove-listeners
Closed

fix(requester-node-http): remove listeners after request settles#1612
Steve0x2a wants to merge 1 commit into
algolia:mainfrom
Steve0x2a:fix/node-http-requester-remove-listeners

Conversation

@Steve0x2a

Copy link
Copy Markdown

createHttpRequester attached data / end / error listeners on each Node http response (and error on the request) and never tore them down. With the keep-alive agent those emitters stay reachable, so the handlers keep response buffers alive across repeated client.search() calls.

On success, error, and timeout, this now calls removeAllListeners() on the request and response so those handlers cannot retain the settled exchange.

Thanks @aymeric-giraudet for the report and the removeAllListeners workaround.

Fixes #1570

Signed-off-by: Yi Zhan <stevesough@gmail.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Thanks for contributing to our API clients! Sorry to close your PR, but this repository is fully generated, you can port your changes to the API Clients Automation repository. If you need some guidance, feel free to open an issue or read our contribution guide.

@github-actions github-actions Bot closed this Sep 7, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 14 complexity · 2 duplication

Metric Results
Complexity 14
Duplication 2

View in Codacy

TIP This summary will be updated as you push new changes.

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.

[bug]: Memory leak in Node requester

1 participant