Repository navigation
fix: Ignore a response that has no pending request - #254
Merged
Merged
Conversation
Some devices send the same response twice. The second copy found no pending request and no handler, so it was logged as an unknown command and answered with an error Default Response, although the device sent a valid response. Ignore responses without a pending request with a debug log instead. Fixes #209
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped fix preserves existing command handling and includes regression coverage for the reported duplicate-response behavior.
No open issues 🎉
What changed in this PR
Fixes #209 by ignoring recognized responses with no pending request instead of treating them as unknown commands and sending an error Default Response.
Changes:
- Adds a debug-logged fallback for unmatched responses and Default Responses, preserving existing handler dispatch and unknown-command errors.
- Adds a regression test confirming that a duplicate Read Attributes Response does not trigger an error reply.
| File | Description |
|---|---|
test/testClusterResponseTimeout.js |
Tests successful response delivery and suppression of an error reply for a duplicate. |
lib/Cluster.js |
Ignores recognized responses that reach the unhandled-command fallback. |
Review effort: Balanced
Only responses without a pending request are ignored; a server-to-client request the cluster has no handler for must still be answered with UNSUP_COMMAND.
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.
When a device sends the same response twice, the first copy resolves the pending request and the second finds no pending request and no handler. It was then logged as
unknown_command_receivedand answered with an error Default Response (FAILURE, and UNSUP_COMMAND since v3.9.0), although the device sent a valid response. Now a response (or Default Response) without a pending request is ignored with a debug log. Unknown non-response commands still get an error Default Response.Fixes #209