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

Plat 9367 thermal state workaround #1514

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

kstenerud
Copy link
Contributor

@kstenerud kstenerud commented Jan 6, 2023

Goal

A bug from iOS 15.0.2 to 15.1.1 causes ThermalStateDidChangeNotification to on rare occasions be posted from within -[NSProcessInfo thermalState], which triggers a recursive call for any listeners since they will in turn call -[NSProcessInfo thermalState] and trigger recursion detection in _os_unfair_lock (_os_unfair_lock_recursive_abort).

See #1511

Ref: https://github.com/Tencent/matrix/blob/master/matrix/matrix-iOS/Matrix/WCCrashBlockMonitor/CrashBlockPlugin/Main/BlockMonitor/WCBlockMonitorMgr.mm#L493

Design

This PR defers the -[NSProcessInfo thermalState] call to a background thread as a workaround.

Testing

Manually tested

@github-actions
Copy link

github-actions bot commented Jan 6, 2023

Bugsnag.framework binary size increased by 248 bytes from 706,448 to 706,696

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +148  +0.1%    +148    __TEXT,__text
  +0.1%    +136  +0.1%    +136    String Table
  +0.1%    +112  +0.1%    +112    Symbol Table
  +1.0%     +32  +1.0%     +32    __DATA,__const
  -0.4%     -32  -0.2%     -32    [__DATA]
  -0.6%    -148  -0.6%    -148    [__TEXT]
  [ = ]       0  -1.7%    -248    [__LINKEDIT]
  +0.0%    +248  [ = ]       0    TOTAL

Generated by 🚫 Danger

@kstenerud kstenerud changed the base branch from master to next January 6, 2023 12:26
@kstenerud kstenerud force-pushed the PLAT-9367-thermal-state-workaround branch from dc6eb82 to 82c6d9b Compare January 6, 2023 12:30
@kstenerud kstenerud requested a review from lemnik January 10, 2023 08:10
@kstenerud kstenerud marked this pull request as ready for review January 10, 2023 08:10
@kstenerud kstenerud force-pushed the PLAT-9367-thermal-state-workaround branch from 82c6d9b to 88a8dda Compare January 11, 2023 10:22
@kstenerud kstenerud force-pushed the PLAT-9367-thermal-state-workaround branch from 88a8dda to fd4851c Compare January 11, 2023 10:38
Copy link

@lemnik lemnik left a comment

Choose a reason for hiding this comment

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

LGTM

@kstenerud kstenerud merged commit 68b51af into next Jan 11, 2023
@kstenerud kstenerud deleted the PLAT-9367-thermal-state-workaround branch January 11, 2023 13:15
@kstenerud kstenerud mentioned this pull request Jan 18, 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.

2 participants