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

Remote JS Debugging crashes app after 30 seconds #12289

Closed
BerndWessels opened this issue Feb 8, 2017 · 35 comments
Closed

Remote JS Debugging crashes app after 30 seconds #12289

BerndWessels opened this issue Feb 8, 2017 · 35 comments
Labels
Bug DX Issues concerning how the developer experience can be improved. JavaScript Resolution: Locked This issue was locked by the bot.

Comments

@BerndWessels
Copy link
Contributor

BerndWessels commented Feb 8, 2017

Description

When using Remote JS Debugging the app crashes after exactly 30 seconds.

Without Remote JS Debugging the app works just fine.

Reproduction

This also happens on a brand new project created like this:

react-native init AwesomeProject
cd AwesomeProject
react-native run-android

Just enable Remote JS Debugging, reload and wait for 30 seconds - the app will crash.

Solution

?

Additional Information

  • React Native version: 0.41.2
  • Platform: Android (haven't tried IOS yet)
  • Operating System: Windows (haven't tried macOS yet)
  • JS Debugger: Chrome Dev Tools, React Native Debugger
@Chathula
Copy link

Chathula commented Feb 25, 2017

i also faced this problem

Additional Information

  • React Native version: 0.41.2
  • Platform: Android
  • Operating System: Kali Linux(Debian)
  • JS Debugger: Chrome Dev Tools, React Native Debugger

@percyteng
Copy link

React Native version: 0.38.0
IOS

It crashes my app right after I open it

@kevmojay
Copy link

React Native version: 0.41.2
Platform: Android device 7.1.2
OS: macOS
JS Debugger: Chrome Dev Tools, React Native Debugger

Android error: FATAL EXCEPTION: main
                                                               Process: com.myapp, PID: 30655
                                                               android.os.NetworkOnMainThreadException
                                                                   at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
                                                                   at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
                                                                   at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
                                                                   at okio.Okio$1.write(Okio.java:78)
                                                                   at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
                                                                   at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
                                                                   at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
                                                                   at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
                                                                   at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
                                                                   at com.facebook.react.devsupport.JSDebuggerWebSocketClient.closeQuietly(JSDebuggerWebSocketClient.java:144)
                                                                   at com.facebook.react.devsupport.WebsocketJavaScriptExecutor$3.run(WebsocketJavaScriptExecutor.java:146)
                                                                   at android.os.Handler.handleCallback(Handler.java:751)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                   at android.os.Looper.loop(Looper.java:154)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

@oronbz
Copy link

oronbz commented Mar 3, 2017

Same happens here
React Native version: 0.41.2
Platform: Android device 7.1.1
OS: macOS
JS Debugger: Chrome Dev Tools, React Native Debugger

FATAL EXCEPTION: main
                                                            Process: com.albums, PID: 11375
                                                            android.os.NetworkOnMainThreadException
                                                                at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
                                                                at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
                                                                at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
                                                                at okio.Okio$1.write(Okio.java:78)
                                                                at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
                                                                at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
                                                                at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
                                                                at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
                                                                at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
                                                                at com.facebook.react.devsupport.JSDebuggerWebSocketClient.closeQuietly(JSDebuggerWebSocketClient.java:144)
                                                                at com.facebook.react.devsupport.WebsocketJavaScriptExecutor$3.run(WebsocketJavaScriptExecutor.java:146)
                                                                at android.os.Handler.handleCallback(Handler.java:751)
                                                                at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                at android.os.Looper.loop(Looper.java:154)
                                                                at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

@stivaugoin
Copy link

I have the same problem

React Native version: 0.42
Platform: Android device 7.1.1
OS: macOS 10.12.3
JS Debugger: Chrome Dev Tools, React Native Debugger

@ds300
Copy link

ds300 commented Mar 10, 2017

Crashes right after turning debug on from the dev menu

React Native version: 0.42
Platform: iOS
OS: OS X 10.11.6
JS Debugger: Chrome Dev Tools, React Native Debugger

@ghost
Copy link

ghost commented Mar 22, 2017

Crashes after ~30 seconds, if it is paused in debugger everything is fine

03-22 11:09:23.844 25887-25887/com.halebop.servicetips.dev E/art: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
03-22 11:10:48.718 25887-2669/? E/UncaughtException: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
                                                         at java.lang.Thread.nativeCreate(Native Method)
                                                         at java.lang.Thread.start(Thread.java:1063)
                                                         at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
                                                         at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
                                                         at okhttp3.ConnectionPool.put(ConnectionPool.java:135)
                                                         at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149)
                                                         at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188)
                                                         at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
                                                         at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
                                                         at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                         at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                         at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                         at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                         at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
                                                         at okhttp3.RealCall.access$100(RealCall.java:33)
                                                         at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
                                                         at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                         at java.lang.Thread.run(Thread.java:818)

React Native version: 0.42
Platform: Android 6
OS: OS X 10.12.3
JS Debugger: Chrome Dev Tools, React Native Debugger

@mrbrentkelly
Copy link
Contributor

mrbrentkelly commented Mar 31, 2017

Same issue here. App crashes a few seconds after enabling remote debugging on my Android Emulator

RN: 0.42.3
Android 7.1.1
OS X 10.12.3

03-31 22:25:33.362 3244-3244/com.vscodetest E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: com.vscodetest, PID: 3244
                                                              android.os.NetworkOnMainThreadException
                                                                  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
                                                                  at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
                                                                  at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
                                                                  at okio.Okio$1.write(Okio.java:78)
                                                                  at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
                                                                  at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
                                                                  at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
                                                                  at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
                                                                  at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
                                                                  at com.facebook.react.devsupport.JSDebuggerWebSocketClient.closeQuietly(JSDebuggerWebSocketClient.java:144)
                                                                  at com.facebook.react.devsupport.WebsocketJavaScriptExecutor$3.run(WebsocketJavaScriptExecutor.java:146)
                                                                  at android.os.Handler.handleCallback(Handler.java:751)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:154)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

@alexander-poe
Copy link

Like a four car pileup

React Native version: 0.42
Platform: iOS
OS: OS X 10.11.6
JS Debugger: Chrome Dev Tools, React Native Debugger

@ghost
Copy link

ghost commented Apr 20, 2017

Getting the same error in my environment.

react-native: 0.43.3
Platform: Android
OS: macOS 10.12.4
JS Debugger: Chrome Dev Tools

@adamjacob
Copy link

Same issue here debugging android

React-native: 0.40.0
Platform: Android
OS: macOS 10.12.4
JS Debugger: Chrome Dev Tools, React Native Debugger

@mrbrentkelly
Copy link
Contributor

mrbrentkelly commented May 3, 2017

The issue seems to be that the React Native code is running a network call on the UI Thread 🤦‍♂️ So I have a workaround...

NOTE: Don't ship this in your release builds as you should never run network calls on the UI Thread. This workaround is just to get debugging working until a proper fix is made by Facebook

In MainApplication.java do the following...

  @Override
  public void onCreate() {
    // There is a bug in React Native preventing remote debugging on Android
    // https://github.com/facebook/react-native/issues/12289
    //
    // This is a hack to get around it. Make sure you remove it before releasing
    // as you should never run network calls on the main thread
    if (BuildConfig.DEBUG) {
      strictModePermitAll();
    }

    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }

  private static void strictModePermitAll() {
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    if (Build.VERSION.SDK_INT >= 16) {
      //restore strict mode after onCreate() returns. https://issuetracker.google.com/issues/36951662
      new Handler().postAtFrontOfQueue(new Runnable() {
        @Override
        public void run() {
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
          StrictMode.setThreadPolicy(policy);
        }
      });
    }
  }

@Carpetfizz
Copy link

Carpetfizz commented May 15, 2017

@mrbrentkelly thank you very much for the fix! It's been over a week month and this is a high priority issue for Android users - would be great to see an official fix soon!

@justgeek
Copy link

@mrbrentkelly This has not solved the issue yet

@sunalyou
Copy link

Same issue here debugging android

React-native: 0.45.1
Platform: Android
OS: WIN7
JS Debugger: Chrome Dev Tools, React Native Debugger

@mrbrentkelly thank you for this fix, but it doesn't work for me.

@itinance
Copy link
Contributor

itinance commented Jul 5, 2017

In order to get @mrbrentkelly workaround compiled, add these 3 lines on top:

import android.os.StrictMode; 
import android.os.Build; 
import android.os.Handler;

Unfortunately the app will still crash as soon as Remote Debugger Mode was activated.

@manpreetmannysingh
Copy link

Facing same issue: @mrbrentkelly

"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
Platform: Android
OS: WIN7
JS Debugger: Chrome Dev Tools, React Native Debugger

@cinder92
Copy link

same issue here

@iegik
Copy link

iegik commented Aug 25, 2017

react-native-cli: 2.0.1
react-native: 0.44.0

android-26 x86 (Android 8.0.0)
App crashes after typing [CMD] + [M] (open debug window)

Unable to add window android.view.ViewRootImpl$W@bd91ba -- permission denied for window type 2003

Permissions are enabled:

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" tools:node="remove"/>

Code from @mrbrentkelly added, thanks, but no lack.

Update:
I have to remove all tools:node="remove" in xml

@iegik
Copy link

iegik commented Aug 25, 2017

This line in AndroidManifest.xml may help:

    <uses-permission android:name="android.permission.TYPE_APPLICATION_OVERLAY"/>

Read more:

@AndrewJack
Copy link
Contributor

AndrewJack commented Aug 31, 2017

@iegik android.permission.TYPE_APPLICATION_OVERLAY doesn't exist. You should use the same SYSTEM_ALERT_WINDOW permission to request TYPE_APPLICATION_OVERLAY

See https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY

@mvaivre
Copy link

mvaivre commented Oct 6, 2017

Anything new about this issue? It's really a pain to develop with the debugger on, as the app crashes 50% of the time when reloading 😞

@bolandrm
Copy link

I've also run into very frequent crashes when working with the remote debugger on android.

"react": "16.0.0",
"react-native": "0.50.1",
Platform: Android
OS: OSX
JS Debugger: Chrome Dev Tools

@stale
Copy link

stale bot commented Jan 13, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 13, 2018
@namnv04
Copy link

namnv04 commented Jan 17, 2018

Still happening to me with RN 0.51.0 and 0.52.0

Looking for help!!!!

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 17, 2018
@devendrabhandari
Copy link

I am still getting same error

"react-native": "0.47.1",

nw_connection_get_connected_socket 287 Connection has no connected handler
TCP Conn 0x60000017ce00 Failed : error 0:61 [61]

@stlemon
Copy link

stlemon commented May 3, 2018

"react-native": "0.44.3",
platform : ios
TCP Conn 0x60400356bf40 Failed : error 0:61 [61]
nw_connection_get_connected_socket 280 Connection has no connected handler

@SimoneMSR
Copy link

SimoneMSR commented Dec 5, 2018

Still an issue with:

"react": "16.3.1",
"react-native": "0.55.4",
Platform: Android
OS: Win10
JS Debugger: Chrome Dev Tools

I solved the issue by disabling 'remote-redux-devtools': in my createStore call i have deleted the composeWithDevTools call. So, sobstitute

const store = createStore (
	persistedReducer,
	composeWithDevTools(applyMiddleware(thunk))
)

with

const store = createStore (
	persistedReducer,
	applyMiddleware(thunk)
)

@FaisalJulaidan

This comment has been minimized.

@kelset kelset added DX Issues concerning how the developer experience can be improved. and removed Core Team labels Mar 4, 2019
@kelset
Copy link
Contributor

kelset commented Mar 4, 2019

Can anyone reproduce this issue on a freshly init'd project with 59-rc3?

@alloy
Copy link
Contributor

alloy commented Mar 19, 2019

Hello there 👋 this issue seems to have been inactive for the past few weeks. Because of this, it's likely that the issue is not a high priority anymore or it has been solved by OP; for these reasons, we'll close it. But please, if it's actually still an issue with 0.59 please comment below and we can reopen it or please send us a Pull Request with a fix 😊

@cutiko
Copy link

cutiko commented Jul 3, 2019

I'm having this problem on 0.60.0

"dependencies": {
    "react": "16.8.6",
    "react-native": "^0.60.0",
  }
implementation "com.facebook.react:react-native:0.60.0"
No implementation found for com.facebook.react.bridge.Inspector

UPDATE:
I was updating my project when finding the error, so to make sure I create a new one from scratch. The problem is not solved, the error is the same.

@mehulmpt
Copy link

mehulmpt commented Jul 4, 2019

The same problem in react native 0.60.0

Here's the complete log in my case:

07-05 00:06:26.708 15134 15170 E unknown:ReactNative: java.lang.UnsatisfiedLinkError: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at com.facebook.react.bridge.Inspector.instance(Native Method)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at com.facebook.react.bridge.Inspector.getPages(Inspector.java:27)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at com.facebook.react.devsupport.InspectorPackagerConnection.getPages(InspectorPackagerConnection.java:152)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at com.facebook.react.devsupport.InspectorPackagerConnection.handleProxyMessage(InspectorPackagerConnection.java:72)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at com.facebook.react.devsupport.InspectorPackagerConnection$Connection.onMessage(InspectorPackagerConnection.java:223)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
07-05 00:06:26.708 15134 15170 E unknown:ReactNative: 	at java.lang.Thread.run(Thread.java:764)

@cutiko
Copy link

cutiko commented Jul 4, 2019

@mehulmpt as far as I know java.lang.UnsatisfiedLinkError means there is a dependency missing. Somehow the code got packaged, and then when the file, class, method is needed, is not there, Java crashes.

@Sukumar-Abhijeet
Copy link

Hey is there any solution to this ?? I am still unable to debug the app.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 20, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug DX Issues concerning how the developer experience can be improved. JavaScript Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests