Skip to content

Only crash in debug mode, if HTTPClient was not shutdown #478

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
Nov 17, 2021

Conversation

fabianfett
Copy link
Member

Motivation

Generally we want to inform users that they need to shutdown their HTTPClient. Until 1.6.0 we did this with an assert in HTTPClient's deinit. With 1.6.0 this behavior was raised to a precondition. This could lead to users to discover suddenly crashes in production, where they have seen none before.

Changes

  • This pr reverts the current behavior back to something pre 1.6.0

Result

  • HTTPClient doesn't crash in production anymore.

switch self.state {
case .shutDown:
break
case .shuttingDown, .upAndRunning:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible for .shuttingDown to ever be valid here? I.e. if using the async shutdown?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, when we are shuttingDown, the HTTPClient is in a retain cycle, that should prevent it from ever going out of memory. Do we want to call this out explicitly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, no harm in it.

@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Nov 17, 2021
@fabianfett fabianfett merged commit ec2e080 into swift-server:main Nov 17, 2021
@fabianfett fabianfett deleted the ff-crash-debug-mode branch November 17, 2021 13:22
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