Today I upgraded from React Native 0.47.2 to 0.48.2 and since that moment the app crashes if I do remote JS debugging.
The same behaviour for both Realm 1.10.3 and 1.11.1.
Here are the most interesting lines from logs:
09-11 18:24:59.804 24888-24953/com.myapp V/JSRealm: setupChromeDebugModeRealmJsContext
09-11 18:24:59.826 24888-24953/com.myapp I/Realm: Starting the debugging WebServer, Host: null Port: 8082
9-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] in call to GetStringUTFChars
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] from java.lang.String io.realm.react.RealmReactModule.processChromeDebugCommand(java.lang.String, java.lang.String)
So it seems that the app crashes on this line.
Full log:
09-11 18:24:59.781 24888-24940/com.myapp V/JSRealm: setDefaultRealmFileDirectory
09-11 18:24:59.781 24888-24940/com.myapp D/JSRealm: Absolute path: /data/data/com.myapp/files
09-11 18:24:59.783 24888-24940/com.myapp D/ReactNative: Initializing React Xplat Bridge.
09-11 18:24:59.784 24888-24940/com.myapp D/ReactNative: Initializing React Xplat Bridge before initializeBridge
09-11 18:24:59.786 24888-24940/com.myapp D/ReactNative: Initializing React Xplat Bridge after initializeBridge
09-11 18:24:59.786 24888-24940/com.myapp D/ReactNative: CatalystInstanceImpl.runJSBundle()
09-11 18:24:59.787 24888-24954/com.myapp D/ReactNative: ReactInstanceManager.setupReactContext()
09-11 18:24:59.787 24888-24954/com.myapp D/ReactNative: CatalystInstanceImpl.initialize()
09-11 18:24:59.788 24888-24953/com.myapp E/BluetoothAdapter: Bluetooth binder is null
09-11 18:24:59.789 24888-24954/com.myapp W/unknown:ReactNative: Packager connection already open, nooping.
09-11 18:24:59.789 24888-24954/com.myapp W/unknown:ReactNative: Inspector connection already open, nooping.
09-11 18:24:59.791 24888-24954/com.myapp D/ReactNative: ReactInstanceManager.attachRootViewToInstance()
09-11 18:24:59.804 24888-24953/com.myapp V/JSRealm: setupChromeDebugModeRealmJsContext
09-11 18:24:59.826 24888-24953/com.myapp I/Realm: Starting the debugging WebServer, Host: null Port: 8082
09-11 18:24:59.832 1619-1629/? I/WindowManager: Destroying surface Surface(name=) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
09-11 18:24:59.833 1619-1639/? I/ActivityManager: Displayed com.myapp/.MainActivity: +926ms
09-11 18:25:00.058 1619-1639/? I/WindowManager: Destroying surface Surface(name=Starting com.myapp) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:491 com.android.server.wm.WindowAnimator.updateWindowsLocked:303 com.android.server.wm.WindowAnimator.animateLocked:704
09-11 18:25:00.065 1619-9336/? I/WindowManager: Destroying surface Surface(name=com.android.launcher3/com.android.launcher3.Launcher) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.AppWindowToken.notifyAppStopped:389 com.android.server.wm.WindowManagerService.notifyAppStopped:4456 com.android.server.am.ActivityStack.activityStoppedLocked:1252 com.android.server.am.ActivityManagerService.activityStopped:6903
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] in call to GetStringUTFChars
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] from java.lang.String io.realm.react.RealmReactModule.processChromeDebugCommand(java.lang.String, java.lang.String)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] "NanoHttpd Request Processor (#1)" daemon prio=5 tid=41 Runnable
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] | group="main" sCount=0 dsCount=0 obj=0x12f25820 self=0x8c188f00
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] | sysTid=24986 nice=0 cgrp=default sched=0/0 handle=0x89a7f920
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] | stack=0x8997d000-0x8997f000 stackSize=1038KB
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] | held mutexes= "mutator lock"(shared held)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #00 pc 0056d8de /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+238)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #01 pc 00539f6e /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+526)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #02 pc 00536f6b /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+75)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #03 pc 0038e868 /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1560)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #04 pc 0038f168 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_Pc+120)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #05 pc 0013d112 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+82)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #06 pc 0013c46f /system/lib/libart.so (_ZN3art11ScopedCheck13CheckInstanceERNS_18ScopedObjectAccessENS0_12InstanceKindEP8_jobjectb+351)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #07 pc 0013b61a /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+394)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #08 pc 0013a26e /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1390)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #09 pc 001444ee /system/lib/libart.so (_ZN3art8CheckJNI22GetStringCharsInternalEPKcP7_JNIEnvP8_jstringPhbb+1054)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #10 pc 00133cb8 /system/lib/libart.so (_ZN3art8CheckJNI17GetStringUTFCharsEP7_JNIEnvP8_jstringPh+72)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #11 pc 00444d3c /data/app/com.myapp-1/lib/x86/librealmreact.so (_ZN7_JNIEnv17GetStringUTFCharsEP8_jstringPh+40)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #12 pc 00445140 /data/app/com.myapp-1/lib/x86/librealmreact.so (Java_io_realm_react_RealmReactModule_processChromeDebugCommand+109)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] native: #13 pc 000a42dc /data/app/com.myapp-1/oat/x86/base.odex (Java_io_realm_react_RealmReactModule_processChromeDebugCommand__Ljava_lang_String_2Ljava_lang_String_2+168)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at io.realm.react.RealmReactModule.processChromeDebugCommand(Native method)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at io.realm.react.RealmReactModule.access$000(RealmReactModule.java:25)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at io.realm.react.RealmReactModule$AndroidWebServer.serve(RealmReactModule.java:161)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:840)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:189)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470] at java.lang.Thread.run(Thread.java:761)
09-11 18:25:01.514 24888-24986/com.myapp A/art: art/runtime/java_vm_ext.cc:470]
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] Runtime aborting...
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] Aborting thread:
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] "NanoHttpd Request Processor (#1)" prio=5 tid=41 Native
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] | group="" sCount=0 dsCount=0 obj=0x12f25820 self=0x8c188f00
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] | sysTid=24986 nice=0 cgrp=default sched=0/0 handle=0x89a7f920
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] | stack=0x8997d000-0x8997f000 stackSize=1038KB
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] | held mutexes= "abort lock"
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #00 pc 0056d8de /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+238)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #01 pc 00539f6e /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+526)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #02 pc 00536f6b /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+75)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #03 pc 00522d43 /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+67)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #04 pc 00522b17 /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+615)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #05 pc 0051327b /system/lib/libart.so (_ZN3art7Runtime5AbortEv+155)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #06 pc 00119572 /system/lib/libart.so (_ZN3art10LogMessageD1Ev+1298)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #07 pc 0038efc5 /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+3445)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #08 pc 0038f168 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_Pc+120)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #09 pc 0013d112 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+82)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #10 pc 0013c46f /system/lib/libart.so (_ZN3art11ScopedCheck13CheckInstanceERNS_18ScopedObjectAccessENS0_12InstanceKindEP8_jobjectb+351)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #11 pc 0013b61a /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+394)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #12 pc 0013a26e /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1390)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #13 pc 001444ee /system/lib/libart.so (_ZN3art8CheckJNI22GetStringCharsInternalEPKcP7_JNIEnvP8_jstringPhbb+1054)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #14 pc 00133cb8 /system/lib/libart.so (_ZN3art8CheckJNI17GetStringUTFCharsEP7_JNIEnvP8_jstringPh+72)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #15 pc 00444d3c /data/app/com.myapp-1/lib/x86/librealmreact.so (_ZN7_JNIEnv17GetStringUTFCharsEP8_jstringPh+40)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #16 pc 00445140 /data/app/com.myapp-1/lib/x86/librealmreact.so (Java_io_realm_react_RealmReactModule_processChromeDebugCommand+109)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] native: #17 pc 000a42dc /data/app/com.myapp-1/oat/x86/base.odex (???)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at io.realm.react.RealmReactModule.processChromeDebugCommand(Native method)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at io.realm.react.RealmReactModule.access$000(RealmReactModule.java:25)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at io.realm.react.RealmReactModule$AndroidWebServer.serve(RealmReactModule.java:161)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:840)
09-11 18:25:01.558 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:189)
09-11 18:25:01.559 24888-24986/com.myapp A/art: art/runtime/runtime.cc:403] at java.lang.Thread.run(Thread.java:761)
@letalumil Is it possible for you to add code which can reproduce this crash?
I have the same problem, I just opened the debug mode.
@kneth OK, here it is: https://github.com/letalumil/realm-js-1294
But literally, all I did to create the sample project is:
react-native init RealmTest
yarn add realm
Then I run react-native run-android, and after enabling the debug mode the app crashes with the stack trace above. I tested on two Android Studio emulators: Nexus 5 API 23 and Nexus 5X API 24, same issue on both.
If it helps, I tried to find since which version the problem occurred, and it seems that it's there since the v0.48.0-rc.0 RN version, everything works fine on v0.47.2.
@letalumil To be honest, we haven't tested Realm JS with 0.48.0-rc.0. I guess we'll wait until 0.48.0 has been released.
@kneth I mentioned version 0.48.0-rc.0 just to let you know when things got broken. Version 0.48.0 has been released 10 days ago, version 0.48.3 has been released yesterday, and the problem persists in all of them.
@letalumil Apparently I have been living under a stone for a while :smile: It sounds like we need a few changes to be compatible with 0.48. I relabel the issue and move it to our backlog so we can put a priority to it. Thanks for bringing it to our attention.
Same thing happend on me, app crashed when turn on debug mode.
error log:
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] in call to GetStringUTFChars
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] from java.lang.String io.realm.react.RealmReactModule.processChromeDebugCommand(java.lang.String, java.lang.String)
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] "NanoHttpd Request Processor (#1)" daemon prio=5 tid=35 Runnable
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x12c3e280 self=0xee506100
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] | sysTid=3542 nice=0 cgrp=default sched=0/0 handle=0xde9ff930
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
09-13 22:09:37.117 3461-3542/com.myapp A/art: art/runtime/java_vm_ext.cc:410] | stack=0xde8fd000-0xde8ff000 stackSize=1038KB
Also having the same issue on RN 0.48 and above.
Same issue...
same issue...
https://github.com/facebook/react-native/commit/c00abe53c3e24218afa694b2b58440403a102fd2 seems to be the reason. The inspector proxy runs on port 8082 in RN >= 0.48 and this interferes with the RPC server Realm uses internally to support Chrome debugging.
I'll try moving the RPC server to a different port and see how that works.
Chrome debugging works fine for me after this fix. Changes are merged into the master branch.
Are you planning to release 1.13.0 with this?
@prabhu Yes, I hope to have time early next week to do a 1.12.1 release (or 1.13.0 if we add some functionality as well).
I manually applied the changes from the patch, although my folder structure was slightly different. I now get:
Realm failed to connect to the embedded debug server inside the app. If attempting to use Chrome debugging from a device, ensure the device is reachable on the same network as this machine.

Downgrading to ReactNative 47 to work around it.
When did you release this fix?
Still waiting on this fix to be released.
this is already fixed and merged and will be released as part of 2.0
If you want you can backport it in your apps by changing this RealmReactModule.java like so
https://github.com/realm/realm-js/pull/1373/commits/7a039d5407a0345bdd6cb3c2cec154b4455d003c#diff-7c0bbffb2b1d56242c8b6670362aa936R161
Application crashes on android Version 8.0 when i want to enable hot reloading or long press on bottom Navigation buttons of mobile device.
@AbdulRehmanDevStudio But only on Android 8?
@agersoncgps @kneth
React Native 0.53
Realm: 2.28
Get the same error when restarting the app on a real device with the debug mode on. I need to switch the app on and off to escape this error, very annoying.
DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://192.168.1.149:8083/create_session'
````
Realm failed to connect to the embedded debug server inside the app. If attempting to use Chrome debugging from a device, ensure the device is reachable on the same network as this machine.
`````
@stonecold123 And 192.168.149 port 8083 is reachable from the device?
Most helpful comment
@prabhu Yes, I hope to have time early next week to do a 1.12.1 release (or 1.13.0 if we add some functionality as well).