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

[iOS] Crash in MutableValue::set #3632

Open
DanijelBojcic opened this issue Oct 1, 2022 · 26 comments
Open

[iOS] Crash in MutableValue::set #3632

DanijelBojcic opened this issue Oct 1, 2022 · 26 comments
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS

Comments

@DanijelBojcic
Copy link

Description

My app is crashing in production.
It usually happens at app start. About every 5th app start will end in crash.

The stacktrace I get from crashlytics:

Crashed: com.apple.main-thread
0  pierre                         0x27fd74 std::__1::__function::__func<reanimated::MutableValue::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)::$_2, std::__1::allocator<reanimated::MutableValue::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)::$_2>, void ()>::operator()() + 580 (shared_ptr.h:580)
1  pierre                         0x2aa1e4 reanimated::Scheduler::triggerUI() + 463 (function.h:463)
2  libdispatch.dylib              0x63094 _dispatch_call_block_and_release + 24
3  libdispatch.dylib              0x64094 _dispatch_client_callout + 16
4  libdispatch.dylib              0x10d44 _dispatch_main_queue_drain + 928
5  libdispatch.dylib              0x10994 _dispatch_main_queue_callback_4CF$VARIANT$mp + 36
6  CoreFoundation                 0x4e0d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
7  CoreFoundation                 0xb5f8 __CFRunLoopRun + 2544
8  CoreFoundation                 0x1e250 CFRunLoopRunSpecific + 572
9  GraphicsServices               0x1988 GSEventRunModal + 160
10 UIKitCore                      0x4e5a88 -[UIApplication _run] + 1080
11 UIKitCore                      0x27efc8 UIApplicationMain + 336
12 pierre                         0x9020 main + 14 (main.m:14)
13 ???                            0x105d344d0 (Missing)

Steps to reproduce

I can only catch it in debug when opening and closing app rapidly.

Snack or a link to a repository

Reanimated version

2.10

React Native version

0.68.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Release mode

Device

Real device

Device model

iPhone 13

Acknowledgements

Yes

@DanijelBojcic DanijelBojcic added the Needs review Issue is ready to be reviewed by a maintainer label Oct 1, 2022
@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Missing info The user didn't precise the problem enough labels Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@tomekzaw
Copy link
Member

tomekzaw commented Oct 2, 2022

Hey @DanijelBojcic, thanks for opening this issue.

Can you please prepare a minimal viable reproduction for this bug?

@Aximem
Copy link

Aximem commented Oct 10, 2022

We're getting the same issue, randomly on release mode only, this is the crash from XCode:

Capture d’écran 2022-10-10 à 14 42 20

Seems to be happening when unmounting a component running an animation.

@DanijelBojcic
Copy link
Author

DanijelBojcic commented Oct 11, 2022

Unfortunately I do not know how to reproduce it...
One thing I've noticed is that it only happens on iOS 16.

Also maybe I should mention that we are using react-native-multithreading / react-native-vision-camera custom implementation for state management with MMKV, that notifies the JS if there is a change.

I assume the crash comes from rapidly calling reanimated::ShareableValue::adapt, when we call a JS callback from the JSI, which then makes other animations to fail ?? idk

@mym0404
Copy link

mym0404 commented Oct 14, 2022

I have no idea this is related to this. But it seems to this is not only iOS16 issue
image

@jinliming2
Copy link
Contributor

jinliming2 commented Oct 23, 2022

I got the same crash on iPhone XR iOS 15.6.1, which does not reproduce consistently, and I did not use react-native-multithreading and react-native-vision-camera either.

image

@jmorey28
Copy link

jmorey28 commented Dec 12, 2022

we are seeing this issue as well iOS 16 only React Native version 68.5

@ParthChugh
Copy link

Any Update on this?

@terribleben
Copy link

I think we are seeing this too. For us, it was from the same JS migration that led to #3917 (which contains a repro repository).

We didn't change our package versions at all - just migrated the JS API to use sharedValue and Gesture.Pan. The exact package versions and code sample are shown in the attached repro repository on that other issue.

After making this change, we started seeing EXC_BAD_ACCESS (attempted to dereference garbage pointer) in reanimated::Scheduler::triggerUI in our Sentry logs. We deployed this change to a small percentage of our traffic (about 3,000 users) and it affected 1.8% of them, which is severe enough that we'll need to roll back the change.

We've also seen a spike in OOM reports on iOS only, so maybe related to #2824, but I don't have any strong evidence of that.

@levepic
Copy link

levepic commented Jan 15, 2023

Same error here, cannot find the cause. Removed animations from the specific screen where it crashes (according to logs) and strangely still having this issue

@mtebele
Copy link

mtebele commented Feb 22, 2023

Same here:

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000018

Crashed: com.apple.main-thread
0  appname                          0x19c780 std::__1::__function::__func<reanimated::MutableValue::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)::$_2, std::__1::allocator<reanimated::MutableValue::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)::$_2>, void ()>::operator()() + 580 (shared_ptr.h:580)

1  appname                          0x1c1894 reanimated::Scheduler::triggerUI() + 463 (function.h:463)

2  libdispatch.dylib              0x24b4 _dispatch_call_block_and_release + 32

3  libdispatch.dylib              0x3fdc _dispatch_client_callout + 20

4  libdispatch.dylib              0x127f4 _dispatch_main_queue_drain + 928

5  libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF + 44

6  CoreFoundation                 0x9a6f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16

7  CoreFoundation                 0x7c058 __CFRunLoopRun + 2036

8  CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612

9  GraphicsServices               0x1368 GSEventRunModal + 164

10 UIKitCore                      0x3a23d0 -[UIApplication _run] + 888

11 UIKitCore                      0x3a2034 UIApplicationMain + 340

12 appname                          0x4ff0 main + 7 (main.m:7)

13 ???                            0x1b2464960 (Falta)

@Dallas62
Copy link

I also attached the issue originaly opened on react-native-screens, got many crash from a while when putting the app in background:
image

I do not used custom animation actually, might be a third party library which is calling the buggy part...

@thibaultfischer
Copy link

Hi, any update on this ?

@TwistedMinda
Copy link

TwistedMinda commented Mar 21, 2023

I also attached the issue originaly opened on react-native-screens, got many crash from a while when putting the app in background

Same here, we're seeing this issue after the app is put in the background. Don't really know how it's possible but sentry shows a lot of "going to background" logs in a row, without any "going active".

I think we gotta wait : #3917

@jayfeldman12
Copy link

@TwistedMinda in that other thread people said upgrading to reanimated 3 fixes the issue, are you thinking that might do the same here? A stable 3 was released last month so it should be doable.

@TwistedMinda
Copy link

@jayfeldman12 I think successfully upgrading to reanimated 3 is gonna fix a lot of bug including this one yes, but I still can't confirm this as I'm stuck by another library currently

@wcastand
Copy link

wcastand commented May 29, 2023

Hi, i'm on v3 of reanimated and get that issue a lot still, switch to expo-router last week and since then got 1XX crahes and that lead me to here. Only iOS 16 like everyone so not sure v3 would fix this unfortunately :/

Screenshot 2023-05-29 at 10 50 09

Screenshot 2023-05-30 at 11 01 57

@TwistedMinda
Copy link

After successfully migrating to reanimated v3 and react-native 0.71.3 all reanimated-related errors on Sentry are gone for me, an awesome step up

@maXXCZ1
Copy link

maXXCZ1 commented Jun 29, 2023

Can anyone else confirm the migration to v3 is viable solution? If so, what react-native version are you running?
We are currently on 0.67.5 (latest version without new architecture) and reanimated 2.4.0.

We experience problems only on iOS, only in production and we struggle to reproduce it regularly as well. We are currently having two options. Get rid of reanimated completely or migrate it, but migrate whole project to latest RN version (and all libraries) is not an option.

@tomekzaw
Copy link
Member

@maXXCZ1 Reanimated 3.3.0 is the most stable version ever so I'd recommend upgrading. Let me know if you encounter any problems, we're happy to help.

@nandorojo
Copy link
Contributor

I think I may have just gotten this error in prod with RNScreens 3.22 and Reanimated 3.5.4 (RN 0.72.5):

image

Does this error seem like it came from Reanimated?

@tomekzaw
Copy link
Member

@nandorojo "Attempted to dereference garbage pointer" looks familiar but the stack trace doesn't so can't say for sure. Could you send me over the whole stack trace?

@tomekzaw
Copy link
Member

@zhou0506 No, there's no "reanimated" or "screens" anywhere in the stack trace.

@jamogon
Copy link

jamogon commented Feb 14, 2024

Hello, any update on this ?

@tomekzaw
Copy link
Member

@jamogon On what exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS
Projects
None yet
Development

No branches or pull requests