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

[runtime] Adding correct cancellation of queue tokens on queue close #592

Merged
merged 3 commits into from
Apr 6, 2023

Conversation

iyzhang
Copy link
Contributor

@iyzhang iyzhang commented Mar 28, 2023

This PR completes the work for cancelling pending queue tokens on close. We add a new abstraction of YielderHandles, which let other coroutines wake a yielded coroutine with an error. The woken coroutine is then expected to complete gracefully with an error. The PR is in 3 parts:

  1. Add YieldHandle and other abstractions needed to support waking up yielded coroutine.
  2. Add tracking to Catnap for yielded coroutines with pending operations per queue. When the operation starts, it is added to the list of pending operations and when it completes, it is removed. On close, every currently pending operation is woken with an error.
  3. Add support to wait on queue tokens after close to our tests. Our testing infrastructure should wait on queue tokens after closing a socket, to ensure that they are not dangling. This finally cleans up state correctly at the end of each test.

@iyzhang iyzhang requested a review from ppenna March 28, 2023 17:06
@iyzhang iyzhang force-pushed the enhancement-runtime-scheduler-cancel-yield branch 2 times, most recently from a3e6f9f to 5bd3f89 Compare April 3, 2023 17:53
@ppenna ppenna self-assigned this Apr 3, 2023
@ppenna ppenna added the enhancement Enhancement Request on an Existing Feature label Apr 3, 2023
@iyzhang iyzhang force-pushed the enhancement-runtime-scheduler-cancel-yield branch from 5bd3f89 to 8fb3ce6 Compare April 3, 2023 21:31
src/rust/catnap/queue.rs Outdated Show resolved Hide resolved
src/rust/scheduler/handle.rs Outdated Show resolved Hide resolved
src/rust/scheduler/handle.rs Outdated Show resolved Hide resolved
src/rust/scheduler/handle.rs Outdated Show resolved Hide resolved
src/rust/catnap/mod.rs Outdated Show resolved Hide resolved
src/rust/catnap/mod.rs Outdated Show resolved Hide resolved
@ppenna ppenna removed their assignment Apr 4, 2023
@ppenna ppenna self-requested a review April 4, 2023 22:04
@iyzhang iyzhang force-pushed the enhancement-runtime-scheduler-cancel-yield branch from 8fb3ce6 to fbc0711 Compare April 5, 2023 19:57
@iyzhang iyzhang force-pushed the enhancement-runtime-scheduler-cancel-yield branch from fbc0711 to c9c4e3c Compare April 6, 2023 20:52
Copy link
Contributor

@ppenna ppenna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this.

tests/rust/tcp-test/accept/mod.rs Show resolved Hide resolved
@iyzhang iyzhang merged commit f28aa0d into dev Apr 6, 2023
10 checks passed
@iyzhang iyzhang deleted the enhancement-runtime-scheduler-cancel-yield branch April 6, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement Request on an Existing Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants