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

KTOR-5332 Fixes iOS unit test deadlock occurring with DarwinClientEngine #3291

Merged
merged 4 commits into from Dec 14, 2022

Conversation

adamsousa
Copy link
Contributor

Subsystem
ktor-client-darwin

Motivation
About a year ago, a pull request was made to fix iOS engine deadlock happening when running iOS unit tests. Since recently upgrading to the ktor 2.0, our team has begun to experience this issue in our iOS unit tests. Looking at DarwinClientEngine.kt, the request queue does not specify currentQueue() like the now deprecated IosClientEngine did prior to the ktor 2.0 update.

Solution
Use the current thread for the request queue

Copy link
Contributor

@rsinukov rsinukov left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. Do you mind updating queue in ktor-client-darwin-legacy module as well?

@adamsousa
Copy link
Contributor Author

adamsousa commented Dec 12, 2022

Sure thing, added

Copy link
Contributor

@rsinukov rsinukov left a comment

Choose a reason for hiding this comment

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

LGTM
Will merge after CI run

@rsinukov rsinukov changed the title Fixes iOS unit test deadlock occurring with DarwinClientEngine KTOR-5332 Fixes iOS unit test deadlock occurring with DarwinClientEngine Dec 12, 2022
@rsinukov
Copy link
Contributor

These 4 tests are failing on CI
Can you check them, please?

DarwinEngineTest
  testCookieIsNotPersistedByDefault[macosX64]
  testQueryWithCyrillic[macosX64]
  testQueryWithMultipleParams[macosX64]
  testRequestInRunBlocking[macosX64]

@adamsousa
Copy link
Contributor Author

Added fix, tests now running blocking call on testing thread

@rsinukov
Copy link
Contributor

I see that code style breaks on imports. Can you fix this too, please?

@rsinukov rsinukov merged commit 28308e7 into ktorio:main Dec 14, 2022
Rattenkrieg pushed a commit to Rattenkrieg/ktor that referenced this pull request Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants