Commit Graph
7 Commits
Author SHA1 Message Date
NachoSoto e65912c902 MainThreadMonitor: don't crash if there is no test in progress (#2838) 2023-07-18 13:57:23 -07:00
NachoSoto 44beda738d MainThreadMonitor: check deadlocks only ever N seconds (#2820) 2023-07-15 08:15:50 -07:00
NachoSoto 7f875ae212 Changed Logger to use os_log (#2608) 2023-06-15 15:13:48 -07:00
NachoSoto fe31904e32 MainThreadMonitor: increased threshold (#2662)
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.
2023-06-15 18:59:02 -03:00
NachoSoto d5b92368e8 MainThreadMonitor: fixed flakiness in CI (#2517)
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.
2023-05-19 16:57:57 -07:00
NachoSoto 3ec75b1f7c MainThreadMonitor: don't monitor thread if debugger is attached (#2502)
See #2463.
If you're actively debugging and interrupt the main thread, it'll end up
asserting, which isn't very convenient.

Copied the logic from https://stackoverflow.com/a/33177600/401024. It's
not the safest code, but this only runs in tests.
2023-05-18 08:06:59 -07:00
NachoSoto 63b1da2106 Integration Tests: add MainThreadMonitor to ensure main thread is not blocked (#2463)
We've had a few reports of deadlocks (#2412, #2375). This might have not
detected them, but it would detect future issues, as well as busy
operations running on the main thread.

Example:
![Screenshot 2023-05-01 at 9 50 22
AM](https://user-images.githubusercontent.com/685609/235492076-b84195ca-67e7-4762-8c56-49b1758c8534.png)
2023-05-12 16:07:54 -04:00