Skip to content

Conversation

@glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Nov 25, 2024

Motivation:

The high/low watermark backpressure strategy assumes that a yield can never happen when there's no outstanding demand. It's reasonably easy for this to not be a true: a handler decoding messages in a loop, for example, may not pay attention to `read() calls and produce when there's no outstanding demand. The channel should of course not read from the socket, so produced values will stop being produced.

Modifications:

  • Alter the high/low watermarks such that demand is only enabled when the buffer depth is below the low watermark, and only disabled when above the high watermark.

Result:

Fewer crashes

(cherry picked from commit ba6608e)

Motivation:

The high/low watermark backpressure strategy assumes that a yield can
never happen when there's no outstanding demand. It's reasonably easy
for this to not be a true: a handler decoding messages in a loop, for
example, may not pay attention to `read() calls and produce when there's
no outstanding demand. The channel should of course not read from the
socket, so produced values will stop being produced.

Modifications:

- Alter the high/low watermarks such that demand is only enabled when
the buffer depth is below the low watermark, and only disabled when
above the high watermark.

Result:

Fewer crashes

(cherry picked from commit ba6608e)
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Nov 25, 2024
@glbrntt glbrntt requested a review from FranzBusch November 25, 2024 10:57
@glbrntt glbrntt enabled auto-merge (squash) November 25, 2024 10:57
@glbrntt glbrntt merged commit a234978 into apple:sendable-backport-branch Nov 25, 2024
43 of 44 checks passed
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.

2 participants