Repository navigation
Commit af9a25a
Fix RCTInstance self-deadlock during invalidate
Summary:
`-[RCTInstance invalidate]` held `_invalidationMutex` while it synchronously called `[_surfacePresenter suspend]`. Stopping surfaces notifies mount observers on the calling thread, and any observer that reaches `callFunctionOnJSModule:` (e.g. `RCTLog` forwarding to JS in debug builds) blocks forever on the same non-recursive mutex.
Release the mutex after setting `_valid = false` and unregistering from the inspector, before `suspend`. Re-entrant calls now see `!_valid` and return.
Changelog:
[iOS][Fixed] - Fix deadlock in `RCTInstance` invalidation when a surface observer calls into JS
Reviewed By: javache
Differential Revision: D1257063161 parent 96dddb0 commit af9a25a
2 files changed
Lines changed: 35 additions & 4 deletions
File tree
- packages/react-native/ReactCommon/react/runtime
- iostests
- platform/ios/ReactCommon
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
244 | 271 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
190 | 192 | | |
| 193 | + | |
| 194 | + | |
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
| |||
0 commit comments