Repository navigation
Conversation
Devices using protocol 3.5 may answer a query with a different sequence number. The resolver registered in _send() was then never called or deleted, so every get() left a pending promise, a p-retry operation and the related buffers in memory (see codetheweb#713). Remove the resolver after _responseTimeout * 5 seconds and resolve the request with undefined. The data itself is still emitted as `data` event. Fixes codetheweb#713 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWPUonRpUEqKFU4NRAdEtK
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #713.
Some devices (seen with a protocol 3.5 EV wallbox) answer a query with a different sequence number. The resolver registered in
_send()is then never called or deleted, so everyget()leaves a pending promise, a p-retry operation and the buffers held by their closures in memory. Polling such a device every 30 s grew the heap by about 7 MB/h until the host ran out of memory (details and heap snapshot numbers in #713).Change
_send()now removes its resolver after_responseTimeout * 5seconds (10 s with the default) if no matching response arrived, and resolves the request withundefined. The timer is cleared when a matching response arrives and isunref'd, so it never keeps the process alive.dataevent, so event-based users are not affected. Callers awaitingget()/refresh()now getundefinedinstead of a promise that never settles.Tests
test/stub.js: the resolver is removed and the request resolves when no matching response arrives, and a matching response still resolves with its payload. The first test fails without this change.npm run lintpasses (only the two existing complexity warnings),npm testpasses (41 tests) on Node.js 22.🤖 Generated with Claude Code
https://claude.ai/code/session_01JWPUonRpUEqKFU4NRAdEtK