react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

Crashing on Android

Open kevinejohn opened this issue 10 years ago • 40 comments

Anyone else experiencing crashing on Android?

Details here: https://github.com/facebook/react-native/issues/6760

kevinejohn avatar May 11 '16 21:05 kevinejohn

I have no idea about what happened here. And we are no longer depend on ReactNativeART anymore

magicismight avatar May 13 '16 04:05 magicismight

I tried both versions react-native-svg and react-native-art-svg and they both seem to crash on random intervals. I found that it does not crash when you turn off debug mode. I don't know why exactly.

You can use the other link's issue to see an example project that crashes in debug mode only:

import React, { Text, View } from 'react-native'; const { Surface, Group, Shape } = React.ART;

If the new version doesn't use React.ART I don't know why it would still behave the same...

kevinejohn avatar May 13 '16 23:05 kevinejohn

We're seeing this too, random crashes due to this package. (Android only)

TRNIntegrations avatar May 21 '16 18:05 TRNIntegrations

+1

insidelabs avatar May 30 '16 07:05 insidelabs

I've run into the same issue with both packages. Interesting for me it doesn't crash when debugging in Chrome, but will consistently crash when it is not.

dmkmedina avatar May 30 '16 07:05 dmkmedina

Clues are badly needed.

Has anyone posted the crash debug info needed to help trouble-shoot this?

I am afraid to invest time in using this component with this issue #38 active

esutton avatar Jun 14 '16 14:06 esutton

@esutton Crash logs are posted here: https://github.com/facebook/react-native/issues/6760

kevinejohn avatar Jun 14 '16 20:06 kevinejohn

Some android phones crash on a ReflectiveOperationException with a SIGSEGV while others throw it correctly. gson suffered from this too: https://github.com/google/gson/issues/817

So it may be that a call to newInstance somewhere is the culprit. An argument might be null or something like that. Search gives me:

fab1an avatar Jun 24 '16 14:06 fab1an

Can consistently reproduce with this app:

https://gogs.sr.ht/SirCmpwn/sotp/src/eef40c5449ef9abe1c994d3f74232e3250293893

ddevault avatar Jun 25 '16 16:06 ddevault

This is also crashing for me on random intervals... crashing is increased when animating.

ryd0rz avatar Aug 07 '16 22:08 ryd0rz

Here is a stack trace from an android crash. Caused by setNativeProps of the transform of a , surrounding an , this error is intermittent, and only occurs occasionally:

Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'transform' of a view managed by: RNSVGSvgView
       at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:88)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:123)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:42)
       at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:34)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.updateProperties(NativeViewHierarchyManager.java:121)
       at com.facebook.react.uimanager.UIViewOperationQueue$UpdatePropertiesOperation.execute(UIViewOperationQueue.java:91)
       at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
       at com.facebook.react.uimanager.UIViewOperationQueue.pauseFrameCallback(UIViewOperationQueue.java:823)
       at com.facebook.react.uimanager.UIImplementation.onHostPause(UIImplementation.java:611)
       at com.facebook.react.uimanager.UIManagerModule.onHostPause(UIManagerModule.java:115)
       at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:179)
       at com.facebook.react.ReactInstanceManagerImpl.tearDownReactContext(ReactInstanceManagerImpl.java:794)
       at com.facebook.react.ReactInstanceManagerImpl.access$500(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.onPreExecute(ReactInstanceManagerImpl.java:184)
       at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
       at android.os.AsyncTask.execute(AsyncTask.java:551)
       at com.facebook.react.ReactInstanceManagerImpl.recreateReactContextInBackground(ReactInstanceManagerImpl.java:727)
       at com.facebook.react.ReactInstanceManagerImpl.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:710)
       at com.facebook.react.ReactInstanceManagerImpl.access$100(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$1.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:138)
       at com.facebook.react.devsupport.DevSupportManagerImpl$18$1.run(DevSupportManagerImpl.java:673)
       at android.os.Handler.handleCallback(Handler.java:746)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5443)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:77)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:123)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:42)
       at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:34)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.updateProperties(NativeViewHierarchyManager.java:121)
       at com.facebook.react.uimanager.UIViewOperationQueue$UpdatePropertiesOperation.execute(UIViewOperationQueue.java:91)
       at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
       at com.facebook.react.uimanager.UIViewOperationQueue.pauseFrameCallback(UIViewOperationQueue.java:823)
       at com.facebook.react.uimanager.UIImplementation.onHostPause(UIImplementation.java:611)
       at com.facebook.react.uimanager.UIManagerModule.onHostPause(UIManagerModule.java:115)
       at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:179)
       at com.facebook.react.ReactInstanceManagerImpl.tearDownReactContext(ReactInstanceManagerImpl.java:794)
       at com.facebook.react.ReactInstanceManagerImpl.access$500(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.onPreExecute(ReactInstanceManagerImpl.java:184)
       at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
       at android.os.AsyncTask.execute(AsyncTask.java:551)
       at com.facebook.react.ReactInstanceManagerImpl.recreateReactContextInBackground(ReactInstanceManagerImpl.java:727)
       at com.facebook.react.ReactInstanceManagerImpl.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:710)
       at com.facebook.react.ReactInstanceManagerImpl.access$100(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$1.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:138)
       at com.facebook.react.devsupport.DevSupportManagerImpl$18$1.run(DevSupportManagerImpl.java:673)
       at android.os.Handler.handleCallback(Handler.java:746)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5443)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `double', but had type `object'
       at com.facebook.react.bridge.ReadableNativeArray.getDouble(ReadableNativeArray.java)
       at com.facebook.react.uimanager.BaseViewManager.setTransformMatrix(BaseViewManager.java:159)
       at com.facebook.react.uimanager.BaseViewManager.setTransform(BaseViewManager.java:58)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:77)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:123)
       at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:42)
       at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:34)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.updateProperties(NativeViewHierarchyManager.java:121)
       at com.facebook.react.uimanager.UIViewOperationQueue$UpdatePropertiesOperation.execute(UIViewOperationQueue.java:91)
       at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
       at com.facebook.react.uimanager.UIViewOperationQueue.pauseFrameCallback(UIViewOperationQueue.java:823)
       at com.facebook.react.uimanager.UIImplementation.onHostPause(UIImplementation.java:611)
       at com.facebook.react.uimanager.UIManagerModule.onHostPause(UIManagerModule.java:115)
       at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:179)
       at com.facebook.react.ReactInstanceManagerImpl.tearDownReactContext(ReactInstanceManagerImpl.java:794)
       at com.facebook.react.ReactInstanceManagerImpl.access$500(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.onPreExecute(ReactInstanceManagerImpl.java:184)
       at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
       at android.os.AsyncTask.execute(AsyncTask.java:551)
       at com.facebook.react.ReactInstanceManagerImpl.recreateReactContextInBackground(ReactInstanceManagerImpl.java:727)
       at com.facebook.react.ReactInstanceManagerImpl.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:710)
       at com.facebook.react.ReactInstanceManagerImpl.access$100(ReactInstanceManagerImpl.java:99)
       at com.facebook.react.ReactInstanceManagerImpl$1.onJSBundleLoadedFromServer(ReactInstanceManagerImpl.java:138)
       at com.facebook.react.devsupport.DevSupportManagerImpl$18$1.run(DevSupportManagerImpl.java:673)
       at android.os.Handler.handleCallback(Handler.java:746)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5443)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

gpEscrivo avatar Aug 24 '16 09:08 gpEscrivo

Did anyone find any solution or workaround for this issue? I am also facing it.

ggsrivas avatar Aug 29 '16 19:08 ggsrivas

+1

simzen85 avatar Aug 31 '16 04:08 simzen85

I could solve this problem for my use case. In my case, I changed my image component with, shouldComponentUpdate() { return false; }

and my app is not crashing now. I don't exactly know what was the root cause of this problem, but definitely my component didn't need to be re-rendered every time.

ggsrivas avatar Aug 31 '16 04:08 ggsrivas

@ggsrivas: This seems to work for me as well. Not sure if its a long term solution though.

dmkmedina avatar Sep 08 '16 20:09 dmkmedina

Not sure if its a long term solution though.

Indeed. I actually animate this component as a core part of my app's functionality.

ddevault avatar Sep 08 '16 20:09 ddevault

I agree. If you need animation then this solution will not work. Actually, in my application, I also have one svg image(loading spinner) which uses animation and my app is working without crash with this component. One way of finding out which element is causing crash is to remove svg elements one by one and see if your app is still crashing or not.

ggsrivas avatar Sep 08 '16 20:09 ggsrivas

The reason might be because of this bug: https://github.com/facebook/fresco/issues/1363

Memory cleanup of animated images is broken in Fresco: https://github.com/facebook/fresco/issues/1363#issuecomment-233865933

fab1an avatar Sep 08 '16 21:09 fab1an

I'm not sure if this ART commit is related with this problem. But I'll get this merged into react-native-svg see what would happen.

magicismight avatar Oct 27 '16 06:10 magicismight

@magicismight Have you made progress on this? Our app (BlitzPick -- not yet available on Google Play, but it is available for iOS) uses react-native-svg for all of its icons, and we're having massive stability problems as we're trying to get it ready for public consumption.

dacarley avatar Nov 05 '16 01:11 dacarley