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

Backport: BaseSocketChannel flushNow IONotificationState changes (#2954) #2981

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Nov 21, 2024

Motivation:

We could previously hit an assert do to a re-entrancy issue where channel and buffered write state could change during a call-out leading to invalid state.

Modifications:

The decision on whether or not we should be registered for future writes is now taken after the call outs to fireChannelWritabilityChanged and fireChannelReadComplete. The new registration state is set to .unregister if the channel is not open or if there are now flushed pending writes.

Result:

Scope for re-entrancy crashes is reduced.

Co-authored-by: Cory Benfield lukasa@apple.com
(cherry picked from commit fdc3a31)

### Motivation:

We could previously hit an assert do to a re-entrancy issue where
channel and buffered write state could change during a call-out leading
to invalid state.

### Modifications:

The decision on whether or not we should be registered for future writes
is now taken after the call outs to `fireChannelWritabilityChanged` and
`fireChannelReadComplete`. The new registration state is set to
`.unregister` if the channel is not open or if there are now flushed
pending writes.

### Result:

Scope for re-entrancy crashes is reduced.

Co-authored-by: Cory Benfield <lukasa@apple.com>
(cherry picked from commit fdc3a31)
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Nov 21, 2024
@Lukasa Lukasa enabled auto-merge (squash) November 21, 2024 10:45
@Lukasa Lukasa merged commit 7bb2d55 into apple:sendable-backport-branch Nov 21, 2024
42 of 44 checks passed
@Lukasa Lukasa deleted the cb-backport-2954 branch November 21, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants