iOS - UI API called on a background thread
See original GitHub issueDescription
Random crash / log when reloading the app in dev.
Platforms
- iOS
- Android
- Web
Screenshots
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView removeGestureRecognizer:]
PID: 52222, TID: 12083840, Thread name: (none), Queue name: com.facebook.react.ShadowQueue, QoS: 33
Backtrace:
4 zinspector3 0x0000000104d79f78 -[RNGestureHandler unbindFromView] + 124
5 zinspector3 0x0000000104d84cdc -[RNGestureHandlerRegistry dropAllHandlers] + 280
6 zinspector3 0x0000000104d7f84c -[RNGestureHandlerManager dropAllGestureHandlers] + 40
7 zinspector3 0x0000000104d808cc -[RNGestureHandlerModule invalidate] + 52
8 zinspector3 0x0000000104ef79fc __26-[RCTCxxBridge invalidate]_block_invoke_2 + 72
9 libdispatch.dylib 0x0000000109db0c6c _dispatch_call_block_and_release + 32
10 libdispatch.dylib 0x0000000109db27bc _dispatch_client_callout + 20
11 libdispatch.dylib 0x0000000109dba8a4 _dispatch_lane_serial_drain + 984
12 libdispatch.dylib 0x0000000109dbb5e0 _dispatch_lane_invoke + 428
13 libdispatch.dylib 0x0000000109dc8168 _dispatch_workloop_worker_thread + 908
14 libsystem_pthread.dylib 0x000000025120e0bc _pthread_wqthread + 288
15 libsystem_pthread.dylib 0x000000025120de5c start_wqthread + 8
2022-05-10 11:58:11.871015-0300 zinspector3[52222:12083840] [reports] Main Thread Checker: UI API called on a background thread: -[UIView removeGestureRecognizer:]
PID: 52222, TID: 12083840, Thread name: (none), Queue name: com.facebook.react.ShadowQueue, QoS: 33
Backtrace:
4 zinspector3 0x0000000104d79f78 -[RNGestureHandler unbindFromView] + 124
5 zinspector3 0x0000000104d84cdc -[RNGestureHandlerRegistry dropAllHandlers] + 280
6 zinspector3 0x0000000104d7f84c -[RNGestureHandlerManager dropAllGestureHandlers] + 40
7 zinspector3 0x0000000104d808cc -[RNGestureHandlerModule invalidate] + 52
8 zinspector3 0x0000000104ef79fc __26-[RCTCxxBridge invalidate]_block_invoke_2 + 72
9 libdispatch.dylib 0x0000000109db0c6c _dispatch_call_block_and_release + 32
10 libdispatch.dylib 0x0000000109db27bc _dispatch_client_callout + 20
11 libdispatch.dylib 0x0000000109dba8a4 _dispatch_lane_serial_drain + 984
12 libdispatch.dylib 0x0000000109dbb5e0 _dispatch_lane_invoke + 428
13 libdispatch.dylib 0x0000000109dc8168 _dispatch_workloop_worker_thread + 908
14 libsystem_pthread.dylib 0x000000025120e0bc _pthread_wqthread + 288
15 libsystem_pthread.dylib 0x000000025120de5c start_wqthread + 8
Steps To Reproduce
- I could not actually reproduce this after it happened the first time.
Expected behavior
Please, don’t call UI methods on non-UI threads 😄
Actual behavior
UI API called on a background thread
Snack or minimal code example
Package versions
- React: 17.0.2
- React Native: 0.67.4
- React Native Gesture Handler: 2.4.2
- React Native Reanimated: 2.8.0
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
swift - Main Thread Checker: UI API called on a background ...
It's hard to find the UI code which is not executed in main thread sometimes. You can use the trick below to locate...
Read more >Any way to fix "UI API called on a background thread" for gets?
Any way to fix "UI API called on a background thread" for gets?
Read more >Main Thread Checker: UI API called on a background ... - GitHub
Hi. In IOS SDK when I delegate remoteParticipants application crashes because of UI trying to call the UI on background thread in SDK....
Read more >Main Thread Checker: UI API called on a ... - Issue Tracker
The checker warns that -[UIApplication applicationState] (called by GMSIsApplicationInBackground) is being called on a background thread. Attached main-thread- ...
Read more >Main Thread Checker: UI API called on a background thread
Which version? v5.2.42037.1112Latest. To Reproduce(If applicable) Steps to reproduce the behavior: Open iOS demo; Start Share. Screenshots.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also getting this in our logs, although I’m currently not entirely sure what triggers it.
When this happens, our app usually becomes unresponsive, where both react-native components and native UI elements do not respond to touches, so this unresponsiveness is possibly related.
Gesture Handler 2.5.0 should fix the issue, if not you can report it again and I’ll reopen the issue.