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

[android] Fix NetworkOnMainThreadException in remote debugger #15246

Closed
wants to merge 4 commits into from

Commits on Jul 28, 2017

  1. [android] Fix NetworkOnMainThreadException in remote debugger

    This commit fixes a crash where we attempt to close the websocket on the main thread after a timeout.
    The crash causes the retry logic to fail and then our device never connects to the debug server.
    
    Here is the following crash:
    
    07-27 15:55:11.216 29240 29240 E AndroidRuntime: FATAL EXCEPTION: main
    07-27 15:55:11.216 29240 29240 E AndroidRuntime: Process: com.deako.android.home.dev, PID: 29240
    07-27 15:55:11.216 29240 29240 E AndroidRuntime: android.os.NetworkOnMainThreadException
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okio.Okio$1.write(Okio.java:78)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at com.facebook.react.devsupport.JSDebuggerWebSocketClient.closeQuietly(JSDebuggerWebSocketClient.java:144)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at com.facebook.react.devsupport.WebsocketJavaScriptExecutor$3.run(WebsocketJavaScriptExecutor.java:148)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:751)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:154)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6236)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    07-27 15:55:11.216 29240 29240 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
    sebirdman committed Jul 28, 2017
    Configuration menu
    Copy the full SHA
    0cc374b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    02bc5ec View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2017

  1. Configuration menu
    Copy the full SHA
    b13f3a2 View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2017

  1. Configuration menu
    Copy the full SHA
    9e07517 View commit details
    Browse the repository at this point in the history