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

React Native: java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by WebSocketModule

Open ZoHayk opened this issue 3 years ago • 89 comments

Hello everyone, I do not use WebSocketModule but gives this error, please help.

Screenshot 2020-05-28 at 00 07 21 Screenshot 2020-05-28 at 00 06 25

ZoHayk avatar May 27 '20 20:05 ZoHayk

:warning: Missing Environment Information
:information_source: Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

github-actions[bot] avatar May 27 '20 20:05 github-actions[bot]

3	09:42:20.822	unknown:ReactContextBaseJavaModule	Unhandled SoftException
java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by WebSocketModule
	at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:67)
	at com.facebook.react.modules.websocket.WebSocketModule.sendEvent(WebSocketModule.java:62)
	at com.facebook.react.modules.websocket.WebSocketModule.access$100(WebSocketModule.java:40)
	at com.facebook.react.modules.websocket.WebSocketModule$1.onMessage(WebSocketModule.java:190)
	at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:322)
	at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
	at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
	at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:273)
	at okhttp3.internal.ws.RealWebSocket$1.onResponse(RealWebSocket.java:209)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)

I have same issue too. Any clue how to get rid this error ?

Here my development env.

System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 206.95 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.4.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Intel x86 Atom_64
      Android NDK: 17.1.4828580
  IDEs:
    Android Studio: Not Found
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_131 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: * => 0.63.0 
  npmGlobalPackages:
    *react-native*: Not Found

fortezhuo avatar Jul 11 '20 03:07 fortezhuo

I have the same issue and pretty much the same development env. Anybody know of solutions?

harikrishnagit avatar Jul 16 '20 22:07 harikrishnagit

I also get this issue, both on my android TV (8.0) and emulator. It occurs when it tries to fetch(). The error is identical as those above, and repeats multiple times in a row. The fetch promise is never rejected, and the error is only visible when watching logcat. It also appears that each time I restart the app, the number of times the error appears multiplies.

System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx
    Memory: 7.63 GB / 15.44 GB
  Binaries:
    Node: 14.6.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 26, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.1
      System Images: android-26 | Android TV Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Version  4.0.0.0 AI-193.6911.18.40.6626763
  Languages:
    Java: 1.8.0_262 - C:\Program Files\AdoptOpenJDK\jdk-8.0.262.10-hotspot\bin\javac.EXE
    Python: 3.8.5 - C:\Program Files (x86)\Python38-32\python.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.2 => 0.63.2
  npmGlobalPackages:
    *react-native*: Not Found

Incognito357 avatar Jul 26 '20 15:07 Incognito357

It seems that my issue was solved by fixing an instance of a chained ".then(SomeClass.callback)" from the fetch request, where the callback method was not a static member of SomeClass. No JS errors or warnings appeared for me telling me that callback didn't exist on the class (it did exist as a static member of the enclosing class, however). Once I tracked this mistake down, I no longer get the exception above. The runtime exception may have been triggered by the promise chain being invalid due to this mistake, but then I'm not sure why a more relevant error wasn't tripped in js linting or even at runtime, and ended up triggering a lower level exception instead.

Incognito357 avatar Jul 27 '20 04:07 Incognito357

I'm having the same problem when setting up a project on a new RN 0.63 base:

2020-07-27 14:58:12.930 7877-7929/? E/unknown:ReactContextBaseJavaModule: Unhandled SoftException
    java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by NativeAnimatedModule
        at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:67)
        at com.facebook.react.animated.NativeAnimatedModule.initialize(NativeAnimatedModule.java:128)
        at com.facebook.react.bridge.ModuleHolder.doInitialize(ModuleHolder.java:236)
        at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:201)
        at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
        at com.facebook.react.bridge.JavaModuleWrapper.getModule(JavaModuleWrapper.java:56)
        at com.facebook.react.bridge.JavaModuleWrapper.getConstants(JavaModuleWrapper.java:126)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:214)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:919)
2020-07-27 14:58:13.173 7877-7929/? E/ReactNativeJNI: logMarker RUN_JS_BUNDLE_END
2020-07-27 14:58:13.234 7877-7951/? E/unknown:ReactContextBaseJavaModule: Unhandled SoftException
    java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by WebSocketModule
        at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:67)
        at com.facebook.react.modules.websocket.WebSocketModule.sendEvent(WebSocketModule.java:62)
        at com.facebook.react.modules.websocket.WebSocketModule.access$100(WebSocketModule.java:40)
        at com.facebook.react.modules.websocket.WebSocketModule$1.onOpen(WebSocketModule.java:156)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:210)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Note that I'm still using the default app code from npx react-native init project

I've just installed some modules so far...

My RN info:

$ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Memory: 990.65 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.1.0 - ~/.nvm/versions/node/v14.1.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v14.1.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 18, 23, 24, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.2
      System Images: a...google_apis | Google APIs Intel x86 Atom Sys..., a...google_apis | Google APIs Intel x86 Atom Sys..., a... | Intel x86 Atom_64, a...google_apis | Google APIs Intel x86 Atom Sys..., a...gle_apis | Google APIs Intel x86 Atom_64 ..., a...-28 | Intel x86 Atom, a... | Intel x86 Atom_64, a...google_apis | Google APIs Intel x86 Atom Sys..., a...-29 | Intel x86 Atom, a... | Intel x86 Atom_64, a...google_apis | Google APIs Intel x86 Atom Sys...
      Android NDK: 20.1.5948944
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_202-release - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    *react-native*: Not Found

zabojad avatar Jul 27 '20 13:07 zabojad

this is happening with me too on 0.63.2 , it started after installing react-native-community/webview

YazeedAsaad avatar Jul 28 '20 08:07 YazeedAsaad

Same issue on RN 0.63.2

kaystd avatar Jul 30 '20 13:07 kaystd

same issue on RN 0.62.2

abdulghanitech avatar Aug 12 '20 07:08 abdulghanitech

same issue on RN 0.62.2

whenmoon avatar Aug 13 '20 12:08 whenmoon

For me it still persists, I have Xiaomi Redmi Note 7, and my code was working perfectly 1 week ago, and suddenly started giving this error... this is driving me crazy. My project needs to access Firebase Realtime Database, which is when the error happens. The gradle probably updated something in the build, because I forced myself to create a new project yesterday, with the command npx react-native init AwesomeTSProject --template react-native-template-typescript. Installed clean copy of "@react-native-firebase/app": "^8.3.1", "@react-native-firebase/auth": "^8.3.3", "@react-native-firebase/database": "^7.4.2",

Until then everything working, I executed the query of the firebase database (database ().ref('test'). once(...)), I managed to get the information normally (YESTERDAY), But today I went to test again, and this error appeared in the clean project, suddenly...

E/unknown:ReactContextBaseJavaModule: Unhandled SoftException
    java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by WebSocketModule
        at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:67)
        at com.facebook.react.modules.websocket.WebSocketModule.sendEvent(WebSocketModule.java:62)
        at com.facebook.react.modules.websocket.WebSocketModule.access$100(WebSocketModule.java:40)
        at com.facebook.react.modules.websocket.WebSocketModule$1.onMessage(WebSocketModule.java:190)
        at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323)
        at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
        at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

The application does not display any feedback (probably because of the Unhandled SoftException), no warning. and your promise is never resolved or rejected.

I tried to synchronize the time, disable automatic time, etc.,

My react version.

  SDKs:
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-29 | Google APIs Intel x86 Atom
  npmPackages:
    react: 16.13.1 => 16.13.1
    react-native: 0.63.2 => 0.63.2

I thinks this is related to the Metro Server when you hit "R" key to reload, they don't handle the connection lost for that second. (I may be talking shit.)

jaikme avatar Aug 17 '20 05:08 jaikme

Anyone from this thread was able to solve the problem or have more info, please?

lumberman avatar Aug 20 '20 00:08 lumberman

+1

jafar-jabr avatar Aug 23 '20 22:08 jafar-jabr

+1

damian-balas avatar Aug 25 '20 10:08 damian-balas

+1

3c133ps3d avatar Aug 31 '20 12:08 3c133ps3d

Having this issue with react native 0.63.2. Any help is appreciated.

The0racle avatar Sep 09 '20 19:09 The0racle

Just happen on Android 5 API 21. Works perfect on Android 10.

ntvinhit avatar Sep 15 '20 05:09 ntvinhit

Having this issue with react native 0.63.2. Any help is appreciated.

RominHalltari avatar Sep 23 '20 13:09 RominHalltari

Same here

hugoh59 avatar Sep 28 '20 12:09 hugoh59

The problem has not been resolved yet.

ZoHayk avatar Sep 28 '20 21:09 ZoHayk

Any update here?

CaptainJeff avatar Oct 07 '20 17:10 CaptainJeff

Same here with 0.62.2

piyush-kukadiya avatar Oct 14 '20 11:10 piyush-kukadiya

same issue with 0.63.3

srfaytkn avatar Oct 19 '20 20:10 srfaytkn

same issue when upgrade to 0.63.3

AngelTrinidad avatar Oct 27 '20 18:10 AngelTrinidad

The exception being discussed in this thread is displayed in the logcat and then the app crashes with the below c++ error.

App is crashing every time when we reload the JS code either using the "Reload" option from debug menu (or) by clicking cmd+R on the metro server terminal.

Can anyone suggest if the exception and crash are related?

--------- beginning of crash A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 10233 (pool-18-thread-), pid 9986 E/libc++abi: terminating with uncaught exception of type std::runtime_error: logging not available for section entry E/libc++abi: terminating with uncaught exception of type std::runtime_error: logging not available for section entry

karthikpala avatar Dec 14 '20 06:12 karthikpala

same issue with 0.63.3

ahmetberkinc avatar Dec 17 '20 12:12 ahmetberkinc

same issue with 0.62.2

senthil7273 avatar Dec 17 '20 23:12 senthil7273

Same issue here with react-native 0.63.0 and Xiaomi in development environment. I tried with Huawei and still works

carmelocatalfamo avatar Dec 20 '20 17:12 carmelocatalfamo

Same issue. App still running as normal but the errors show continuously.

RN 0.63.4 Some users crash right after open app, I don't know if this is the reason or not.

ntvinhit avatar Dec 24 '20 04:12 ntvinhit

Any solved the issue .Iam getting same use while using react-native-google-fit. while calling getActivitySamples function .

JanakiNarayanan avatar Jan 18 '21 15:01 JanakiNarayanan