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

MainThreadMonitor: fixed flakiness in CI #2517

Merged
merged 1 commit into from
May 19, 2023

Conversation

NachoSoto
Copy link
Contributor

Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/11230/workflows/78444bf6-22b8-40fc-ad92-1f29279377d0/jobs/69663
This is meant to detect deadlocks. 1 second is unfortunately too low for CI with limited resources.

@NachoSoto NachoSoto added the test label May 19, 2023
@NachoSoto NachoSoto requested a review from a team May 19, 2023 20:05
@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Merging #2517 (7ee5304) into main (55818e7) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2517      +/-   ##
==========================================
- Coverage   87.83%   87.82%   -0.01%     
==========================================
  Files         199      199              
  Lines       13647    13647              
==========================================
- Hits        11987    11986       -1     
- Misses       1660     1661       +1     

see 1 file with indirect coverage changes

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@NachoSoto NachoSoto merged commit d5b9236 into main May 19, 2023
@NachoSoto NachoSoto deleted the main-thread-monitor-threshold branch May 19, 2023 23:57
NachoSoto added a commit that referenced this pull request May 25, 2023
This was referenced May 31, 2023
NachoSoto added a commit that referenced this pull request Jun 15, 2023
See also #2517.

We keep getting flaky failures with this in CI, which is annoying because it marks the whole test run as failed and it doesn't retry.
The reason for that is because we have to use `fatalError` and can't use `fail()` because this detection has to happen outside the main thread.
If the main thread is blocked, well, we can't rely `XCTest` to run in the main thread.

Ultimately, we can't guarantee that CI machines will be fast enough to ensure they don't get blocked.
The purpose of this class was to detect deadlocks. By increasing it to 30 seconds, we pretty much avoid flaky failures for slow CI machines, but still have the ability to detect if the main thread is deadlocked due to a locking issue.
NachoSoto added a commit that referenced this pull request Jun 15, 2023
See also #2517.

We keep getting flaky failures with this in CI, which is annoying
because it marks the whole test run as failed and it doesn't retry.
The reason for that is because we have to use `fatalError` and can't use
`fail()` because this detection has to happen outside the main thread.
If the main thread is blocked, well, we can't rely `XCTest` to run in
the main thread.

Ultimately, we can't guarantee that CI machines will be fast enough to
ensure they don't get blocked.
The purpose of this class was to detect deadlocks. By increasing it to
30 seconds, we pretty much avoid flaky failures for slow CI machines,
but still have the ability to detect if the main thread is deadlocked
due to a locking issue.
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.

2 participants