Skip to content

asyncThrowingChannel: fixes potential crashes when no more awaiting #150

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

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

twittemb
Copy link
Contributor

@twittemb twittemb commented Apr 20, 2022

This PR is the sister from this one #143 but for AsyncThrowingChannel that suffers from the very same issue.

The issue is described here: #142

Before this PR, an AsyncThrowingChannel could crash in the following context:

  • start an iteration in a Task
  • cancel the task while the AsyncThrowingChannel is being awaited
  • send a value in the channel

An issue has already been created to track the implementation of unit tests to ensure non regression: #148

This commit fixes crashes where the state is "awaiting" with no more awaiting clients.
The state is now set to .idle to reflect the reality.
Copy link
Member

@phausler phausler left a comment

Choose a reason for hiding this comment

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

Yea, same fix, same previous caveat that we need to follow up with some way of validating this in tests; looks right to me.

@phausler phausler merged commit 6d5d631 into apple:main Apr 21, 2022
@twittemb twittemb deleted the fix/asyncThrowingChannel-awaiting branch May 4, 2022 20:18
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.

2 participants