react-native-reanimated: iOS: Full app crash

Description

I’m receiving the following error on iOS:

com.facebook.react.JavaScript (17): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

I’ve implemented a stories screen using react-native-navigation, and see this error when I quickly close the story (= unmount the screen) while (or shortly before) I run an animation with reanimated. In this case it’s a withTiming worklet.

This is my call stack at the time of the crash:

Screenshots

Steps To Reproduce

  1. Create app using react-native-navigation and reanimated
  2. Open and close stories like a maniac
  3. At some point, close the story (and therefore unmount the screen) exactly when a worklet is being started, not sure it it’s caused by a timing function, or the timing function having a callback and then unmounting the Reanimated View.

Expected behavior

I expect the story to close and any reanimated worklets/animations/state to be disposed

Actual behavior

The app crashes with the error com.facebook.react.JavaScript (17): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

Screenshot 2020-09-26 at 18 44 27

Snack or minimal code example

Working on this. Have to strip out a lot of things, not sure if I can easily replicate it using a simple example…

Package versions

  • React: 16.13.1
  • React Native: 0.63.2
  • React Native Reanimated: 2.0.0-alpha7
  • React Native Navigation: 7.0.0-snapshot2020

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Same as @kanelloc ,

xcode 13 RN 0.66 Reanimated 2.3.0-beta.2

?

We are almost sure what is causing the problem. We are working on it and should be solved soon.

@kanelloc @592da - same thing here - app freezing on a specific (but not all) call to goBack() animation - did you figure out any fix here?

I’m also getting an iOS app freeze when regular animations run alongside reanimations. Specifically, the main thread is stuck waiting for a semaphore on line 227 of REANodesManager.m, in the performOperations method:

dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

With ^2.0.0-alpha.8, it works great on my app which had this issue on beta ^2.0.0-alpha.7. Thanks for your awesome work ! 🎉

If I replace in the file REANodesManager.m line 228 : dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

By : dispatch_semaphore_signal(semaphore);

It is working !

Is it bad ? Will it hurts my iPhone memory ? Can it break react-native-reanimated ? What do you think about it @Szymon20000 @jpudysz @mrousavy ?

Thanks for the reply, I hope we will find a solution…

I have the same issue with a header, animated while scrolling But the same animation was working 2 days ago, before react-native upgrade (0.63.0 -> 0.63.2)