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

[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x28048f800 #27463

Closed
DongDongDongDong opened this issue Dec 10, 2019 · 30 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@DongDongDongDong
Copy link

small probability of the following error:

-[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x28048f800
NSInvalidArgumentException

React Native version:0.61

@DongDongDongDong

This comment has been minimized.

@letscms
Copy link

letscms commented Dec 10, 2019

Same issue with me.
Anyone could you please provide solution of this

@letscms
Copy link

letscms commented Dec 10, 2019

react-issue

@letscms

This comment has been minimized.

@ovy9086
Copy link

ovy9086 commented Dec 11, 2019

same here. started seeing this since 0.61 in our user crashlogs 🤕

@ovy9086
Copy link

ovy9086 commented Dec 11, 2019

here's the full stacktrace

    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:]
    Frameworks/CoreFoundation.framework/CoreFoundation ____forwarding___
    Frameworks/CoreFoundation.framework/CoreFoundation ___forwarding_prep_0___
    Frameworks/QuartzCore.framework/QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
    Frameworks/IOKit.framework/Versions/A/IOKit _IODispatchCalloutFromCFMessage
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFMachPortPerform
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoSource1
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain
    /Users/vagrant/git/ios/rituals/main.m:17:12 main
    /usr/lib/system/libdyld.dylib _start```

@ovy9086
Copy link

ovy9086 commented Dec 11, 2019

I've tracked this back to this commit : abf612a

@fkgozali any input on this ? 🙏

@vanhungoz
Copy link

Last Exception Backtrace:
0 CoreFoundation 0x219f58518 __exceptionPreprocess + 228 (NSException.m:172)
1 libobjc.A.dylib 0x2191339f8 objc_exception_throw + 56 (objc-exception.mm:557)
2 CoreFoundation 0x219e75278 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:323)
3 CoreFoundation 0x219f5dd60 forwarding + 1408 (NSForwarding.m:3224)
4 CoreFoundation 0x219f5f9fc _CF_forwarding_prep_0 + 92
5 QuartzCore 0x21e2ba194 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636 (CADisplay.mm:2332)
6 IOKit 0x21a1b4718 IODispatchCalloutFromCFMessage + 488 (IOKitLib.c:1216)
7 CoreFoundation 0x219ec3d30 __CFMachPortPerform + 188 (CFMachPort.c:522)
8 CoreFoundation 0x219eea934 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 56 (CFRunLoop.c:1996)
9 CoreFoundation 0x219eea080 __CFRunLoopDoSource1 + 440 (CFRunLoop.c:2133)
10 CoreFoundation 0x219ee4ea4 __CFRunLoopRun + 2096 (CFRunLoop.c:3152)
11 CoreFoundation 0x219ee4354 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
12 GraphicsServices 0x21c0e479c GSEventRunModal + 104 (GSEvent.c:2245)
13 UIKitCore 0x246357b68 UIApplicationMain + 212 (UIApplication.m:4353)
14 yakuodo 0x10422f540 main + 88 (main.m:14)
15 libdyld.dylib 0x2199aa8e0 start + 4

@vanhungoz
Copy link

vanhungoz commented Dec 20, 2019

i think this commit makes this issue 6d6b532

vanhungoz referenced this issue Dec 20, 2019
Summary:
@public
CADisplayLink strongly holds onto its target, so you have to use a weak proxy object to pass the target into the CADisplayLink.

Previously we passed a weak-self point (i.e. weakSelf) but this did not have the intended effect, since the pointer to self would still be passed to CADisplayLink, and thus it would hold onto the RCTUIImageViewAnimated strongly.

So is weakSelf doing anything other than using self?
It is but it's very minor and not useful. In the case that the object got de-allocated between assigning self to weakSelf and creating the CADisplayLink, then we would pass a nil target. This is actually impossible though because we are running an instance method, so self is implicitly retained! So semantically it is something different but in practice it is the same as passing self through.

Notes:
* This system was added originally in #24822
* #25636 then "enabled" this system by deprecating existing approach

Reviewed By: fkgozali

Differential Revision: D16939869

fbshipit-source-id: 7a0e947896f23aa30ad074d1dcb4d4db7543e00a
@johndm76
Copy link

johndm76 commented Dec 30, 2019

Same issue here. Started seeing this since RN 0.61 in app crashlogs.
Just to mention that app crashes randomly on this issue, not always.
Please help.

@asleepace
Copy link

Any update on this?

@Anshuman71
Copy link

I got the same in crashlytics. Any solution yet?

@ata-kaya
Copy link

ata-kaya commented Feb 4, 2020

any update on this? I got some crash becuase of this issue on store. do anyone have any solution?

@fkgozali
Copy link
Contributor

fkgozali commented Feb 4, 2020

Sorry for the lack of update. We haven't found any traces in FB production crashes that matched this issue, so it's hard to know how to address this.

Can someone create a minimal repro steps using a sample screen inside RNTester iOS? With smaller repro steps, it'll be easier to triage and find a solution.

@ata-kaya
Copy link

ata-kaya commented Feb 5, 2020

@fkgozali
Actually it's same as this issue I think.
Already mentioned in comments but I leave the full backtrace here again:

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x212ed7180 __exceptionPreprocess
1  libobjc.A.dylib                0x2120af9f8 objc_exception_throw
2  CoreFoundation                 0x212df39bc -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x212edc9c8 ___forwarding___
4  CoreFoundation                 0x212ede65c _CF_forwarding_prep_0
5  QuartzCore                     0x2172e7ff0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
6  IOKit                          0x2131344b0 IODispatchCalloutFromCFMessage
7  CoreFoundation                 0x212e42990 __CFMachPortPerform
8  CoreFoundation                 0x212e69594 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
9  CoreFoundation                 0x212e68ce0 __CFRunLoopDoSource1
10 CoreFoundation                 0x212e63b04 __CFRunLoopRun
11 CoreFoundation                 0x212e62fb4 CFRunLoopRunSpecific
12 GraphicsServices               0x21506479c GSEventRunModal
13 UIKitCore                      0x23f50ac38 UIApplicationMain
14 Project                        0x1006dc928 main + 16 (main.m:16)
15 libdyld.dylib                  0x2129268e0 start

and also here is my react-native info output:

 OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4570R CPU @ 2.70GHz
    Memory: 238.51 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 21, 22, 23, 24, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.2, 23.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

'm getting at least 1k crash every day becuase of this issue

@ovy9086
Copy link

ovy9086 commented Feb 5, 2020

@omid-zamani what makes you think those are related... ? 🤔

@fkgozali
Copy link
Contributor

fkgozali commented Feb 5, 2020

Already mentioned in comments but I leave the full backtrace here again:

Right, that's the stack trace, but we still don't have a solid way to reproduce the issue, i.e. what kind of code in your app triggered this crash?

#19078 is an old issue, I don't think it is related to RCTWeakProxy.

@aibrahim3546
Copy link

@fkgozali
Hey, I have a flatlist which load more than 20 images at a time. so when i scroll and my flat list reached almost 200 of images. My app crashed and throw this error. The images are WebP images and the size of the images are 500 x 500. Will be great if you able to help. Thanks.

@fkgozali
Copy link
Contributor

fkgozali commented Feb 7, 2020

@aibrahim3546

Hey, I have a flatlist which load more than 20 images at a time. so when i scroll and my flat list reached almost 200 of images. My app crashed and throw this error. The images are WebP images and the size of the images are 500 x 500. Will be great if you able to help. Thanks.

Any chance you could put your FlatList usage sample code somewhere in RNTester JS as a repro case? If we can repro the crash with RNTester, I think that would be a big step towards debugging the problem.

@vzts
Copy link

vzts commented Apr 22, 2020

I am seeing this as well from my bugsnag, but could not get my head around where the issue stems from.

NSException object:

address
0
nsexception
{
  "name": "NSInvalidArgumentException",
  "referenced_object": {
    "ivars": {
      "_target": {
        "ivars": {
          "_currentTime": 0.00365243,
          "_currentFrame": {
            "address": 10771867776,
            "type": "objc_object",
            "class": "UIImage"
          },
          "_currentFrameIndex": 76,
          "_bufferMiss": false,
          "_totalLoopCount": 0,
          "_totalFrameCount": 209,
          "_currentLoopCount": 0,
          "_maxBufferSize": 0,
          "_animatedImage": {
            "address": 10777021184,
            "type": "objc_object",
            "class": "RCTAnimatedImage"
          },
          "_frameBuffer": {
            "address": 10756376800,
            "type": "objc_object",
            "class": "__NSDictionaryM"
          }
        },
        "type": "objc_object",
        "class": "RCTUIImageViewAnimated",
        "address": 4713924304
      }
    },
    "type": "objc_object",
    "class": "RCTWeakProxy",
    "address": 10754999872
  }
}
reason
-[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640
type
nsexception

What would this exactly mean? Something to do with RCTUIImageViewAnimated?

Stack Trace:

NSInvalidArgumentException -[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:]
    Frameworks/CoreFoundation.framework/CoreFoundation ____forwarding___
    Frameworks/CoreFoundation.framework/CoreFoundation ___forwarding_prep_0___
    Frameworks/QuartzCore.framework/QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
    Frameworks/IOKit.framework/Versions/A/IOKit _IODispatchCalloutFromCFMessage
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFMachPortPerform
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoSource1
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain
    deer _mh_execute_header
    /usr/lib/system/libdyld.dylib _start

react-native info:

System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 151.32 MB / 16.00 GB
    Shell: 5.6.2 - /usr/local/bin/zsh
  Binaries:
    Node: 10.14.2 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 26, 27, 28
      Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2

One interest finding is that the devices having this issue are confined to iPhone 7 Plus(37.3%), iPhone 6S(32.0%), iPhone 7(21.3%), iPhone SE(6.7%) - old devices on iOS 13.3.1 or 13.4.1. Probably I should test with one of these devices first. Will get back if I have any more finding.

@dephiros
Copy link

We found this commit that seems to address the issue: e5a6655

Maybe we can close this now?

@clicman
Copy link

clicman commented May 15, 2020

Are any estimates on it?

@fkgozali
Copy link
Contributor

We found this commit that seems to address the issue: e5a6655
Are any estimates on it?

Yes, this should be fixed in master. Closing

@JLucasCAmorim
Copy link

JLucasCAmorim commented Jun 2, 2020

Hi @fkgozali, I'm using the v0.62, and I am still getting this issue. Is there any workaround to fix it until the v0.63 has been released?

@dephiros
Copy link

dephiros commented Jun 3, 2020

Hi @fkgozali, I'm using the v0.62, and I am still getting this issue. Is there any workaround to fix it until the v0.63 has been released?

For a temp workaround, we applied a small patch inspired by #28070 through a postinstall script in package.json. Hope this helps!

#!/usr/bin/env bash
set -e

# Patch RCTWeakProxy.m until RN fixes https://github.com/facebook/react-native/issues/27463
OLD_LINE_WEAK_PROXY_ONE="- (id)forwardingTargetForSelector:(SEL)aSelector"
NEW_LINES_WEAK_PROXY_ONE="- (void)displayDidRefresh:(CADisplayLink *)displayLink /* patched */"
OLD_LINE_WEAK_PROXY_TWO="  return _target;"
NEW_LINES_WEAK_PROXY_TWO="  return [_target displayDidRefresh:displayLink]; /* patched */"
sed -i -e "s|${OLD_LINE_WEAK_PROXY_ONE}|${NEW_LINES_WEAK_PROXY_ONE}|" node_modules/react-native/React/Base/RCTWeakProxy.m
sed -i -e "s|${OLD_LINE_WEAK_PROXY_TWO}|${NEW_LINES_WEAK_PROXY_TWO}|" node_modules/react-native/React/Base/RCTWeakProxy.m

@kaushals9
Copy link

kaushals9 commented Sep 4, 2020

@DongDongDongDong I'm facing the same issue, Is there any solution yet? My react-native version is 0.62.2.

@kaushals9
Copy link

kaushals9 commented Sep 4, 2020

Anyone knows is this issue fixed in react-native version is 0.63?

@Muzzamil75
Copy link

same issue in Rn 0.63.3

@mit4dev
Copy link

mit4dev commented Feb 11, 2021

Same issue on rn 0.62.2

Also, it seems like certain devices are affected according to my crashlytics report:

  • iPhone 7 (A1778)
  • iPhone 6s
  • iPhone 7 Plus (A1784)
  • iPhone SE

@mccooll
Copy link

mccooll commented Feb 11, 2021

It looks like the fix will arrive in 0.64.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests