App crashes with the error INVALID_STATE_ERR

Viewed 2152

I am using react native. I am getting the crashes on crashlytics with the error INVALID_STATE_ERR.I am using FireBase Crashlytics. I am also using MQTT client for making web socket connection.

I am not able to figure out the reason of crashing the app. Is it due to the MQTT WebSockets or due to the error occurring on javascript thread? I am also not getting any relevant message from the stack trace either. I am pasting my Stack Trace below.

    Fatal Exception: com.facebook.react.common.JavascriptException: INVALID_STATE_ERR, stack:
    value@79:1340
    _socket_send@557:21101
    _on_socket_open@557:16408
    <unknown>@557:628
    value@63:1501
    <unknown>@79:4566
    value@32:1363
    value@18:3559
    <unknown>@18:1044
    value@18:2986
    value@18:1016

   at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
   at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
   at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
   at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
   at android.os.Looper.loop(Looper.java:148)
   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
   at java.lang.Thread.run(Thread.java:818)

Can I get more insight to fix this issue?

1 Answers

According to this Wix GitHub issue, it is caused by:

Too many views on older phones. RNN added a few nested views, but it appears I may have too many anyways.

That issue links to a pull request on React Native's GitHub repo, which should now be merged in. It mentions the issue is on pre-API 21, so I suggest you try your code on later APIs and see if it persists.

Either way, reducing the number of views (or requests, in this case?) seems a good first step.

Related