Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: handle duplicate request IDs within a single batch #77

Merged
merged 3 commits into from
Feb 4, 2022

Conversation

creachadair
Copy link
Owner

Previously, if two or more calls arrived in a single batch with the same request ID, the server would process the first one and report the rest as having duplicate IDs.

This is subtly wrong, in that the client has no way of knowing which of the duplicates should get the successful call, and which should get the errors. Although a client sending such requests is already wrong, this makes the error harder to debug.

Instead, check for duplicates within the batch during assignment, and fail all the colliding requests.

  • Add a regression test for duplicate requests in a single batch.
  • Add a shared common error for InvalidParams.
  • Add a shared error base for NoSuchMethod.

Previously, if two or more calls arrived in a single batch with the same
request ID, the server would process the first one and report the rest as
having duplicate IDs.

This is subtly wrong, in that the client has no way of knowing which of the
duplicates should get the successful call, and which should get the errors.
Although a client sending such requests is already wrong, this makes the error
harder to debug.

Instead, check for duplicates within the batch during assignment, and fail all
the colliding requests.

Add a regression test for duplicate requests in a single batch.
@creachadair creachadair merged commit 1a458a9 into default Feb 4, 2022
@creachadair creachadair deleted the mjf/batch-dup branch February 4, 2022 18:54
creachadair added a commit that referenced this pull request Feb 8, 2022
Fixes:
- 1a458a9 server: handle duplicate request IDs within a single batch (#77)
- b6901af Front-load handling of callback responses from the client. (#79)

Cleanup:
- 9cb4b74 Document method origin in ParseQuery.
- 8b046b1 Add more goroutine leak checks.
- f2aaf13 Use code strings consistently.
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.

1 participant