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

Add a barrier constraining execution order for notifications. #22

Closed
wants to merge 12 commits into from

Conversation

creachadair
Copy link
Owner

An attempt to address #20.

When issuing a batch of requests, keep track of the number that are valid notifications, and do not issue to any handler for the batch until all notifications received in previous batches have completed.

This ensures a sensible partial order on notifications. Multiple notifications in a single batch can still be executed in parallel, but notifications across batches are no longer concurrent.

Before merging:

Update the batch call test to verify that the reply to a batch containing a
notification correctly omits the notification.
This test exercises the problem described in #20, where notification handlers
can issue out of order relative to their receipt. At this commit the test fails.
When issuing a batch of requests, keep track of the number that are valid
notifications, and do not issue to any handler for the batch until all
notifications received in previous batches have completed.

This ensures a sensible partial order on notifications. Multiple notifications
in a single batch can still be executed in parallel, but notifications across
batches are no longer concurrent.
When the channel to the client closes, the server discards any calls that are
pending in the queue, but retains notifications. The logic for pruning the
queue was incorrect, and would handle items in the wrong order.
The server fully transmits a response to the client before updating metrics. In
the unit test, this means the client can observe the request to complete before
the metrics are actually updated. This causes occasional spurious test failures
in the check for metrics being updated: Spurious, because the metric DOES get
updated, just not immediately.

Avert this issue by fully shutting down the server before doing any of the
metric checks. No functional changes.
Add a section to the main doc page about order of execution.
Clarify that concurrency does not constrain issue.
@creachadair creachadair self-assigned this Jul 15, 2020
@creachadair creachadair removed their assignment Jul 15, 2020
@creachadair creachadair deleted the notify-sequence branch July 15, 2020 16:31
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.

Support sequential request processing or selective request ordering
1 participant