Skip to content

[HTTPConnectionPool] Fix request timer scheduling #438

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

Conversation

fabianfett
Copy link
Member

Motivation

If the allocator puts a request at the same address where another request has lived before and we ran into a timer race before, we run into an assertion. This can be seen in test runs here:

https://ci.swiftserver.group/job/async-http-client-swift55-prb/137/console

Changes

  • Remove timerLock from HTTPConnectionPool

Result

  • No more race conditions. One lock is easier than two.

@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Sep 24, 2021
@fabianfett fabianfett added this to the HTTP/2 support milestone Sep 24, 2021
@fabianfett
Copy link
Member Author

swift-nightly failing because of Sendable requirements.

}
}
scheduled.forEach { $0.cancel() }
cancelTimer.cancel()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we do these cancels outside the lock?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea!

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do at a later point, tracked here: #439

@fabianfett fabianfett requested a review from Lukasa September 24, 2021 13:36
@fabianfett fabianfett merged commit dca46a9 into swift-server:main Sep 24, 2021
@fabianfett fabianfett deleted the ff-flaky-request-scheduling branch September 24, 2021 13:38
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