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. #24

Merged
merged 1 commit into from
Jul 15, 2020

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:

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.

Update tests and documentation.
@creachadair creachadair self-assigned this Jul 15, 2020
@creachadair
Copy link
Owner Author

Checks are still not triggering. Possibly https://www.githubstatus.com/incidents/phnch1rww464 is related; I'll check back later.

@creachadair creachadair merged commit b76a50a into master Jul 15, 2020
@creachadair creachadair deleted the notify-issue branch July 15, 2020 18:48
creachadair added a commit that referenced this pull request Aug 13, 2020
Fixes #27. Since #24, the server holds its lock during dispatch to wait for
previously-issued notifications to settle. This is necessary to ensure a
sensible order of operations; however, it interacts badly with a notification
handler that uses the jrpc2.CancelRequest helper: That function itself acquires
the server lock, and the two (may) deadlock.

To avert this problem, wait on the notification barrier outside the lock.
Add a regression test against the original bug.
creachadair added a commit that referenced this pull request Aug 14, 2020
Fixes #27. Since #24, the server holds its lock during dispatch to wait for
previously-issued notifications to settle. This is necessary to ensure a
sensible order of operations; however, it interacts badly with a notification
handler that uses the jrpc2.CancelRequest helper: That function itself acquires
the server lock, and the two (may) deadlock.

To avert this problem, wait on the notification barrier outside the lock.
Add a regression test against the original bug.
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