Skip to content

Conversation

Lukasa
Copy link
Collaborator

@Lukasa Lukasa commented Aug 5, 2022

Motivation

When receiving certain patterns of response body parts, we can end up
recursing almost indefinitely to deliver them to the application. This
can lead to crashes, so we might politely describe it as "sub-optimal".

Modifications

Keep track of our stack depth and avoid creating too many stack frames.
Added some unit tests.

Result

We no longer explode when handling bodies with lots of tiny parts.

Motivation

When receiving certain patterns of response body parts, we can end up
recursing almost indefinitely to deliver them to the application. This
can lead to crashes, so we might politely describe it as "sub-optimal".

Modifications

Keep track of our stack depth and avoid creating too many stack frames.
Added some unit tests.

Result

We no longer explode when handling bodies with lots of tiny parts.
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Aug 5, 2022
@Lukasa Lukasa requested a review from dnadoba August 5, 2022 13:36
Copy link
Collaborator

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

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

Great patch, thanks!

@Lukasa Lukasa merged commit df87a86 into swift-server:main Aug 5, 2022
@Lukasa Lukasa deleted the cb-prevent-stack-overflow branch August 5, 2022 16:53
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