facebookarchive / stetho

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.
http://facebook.github.io/stetho/
MIT License
12.66k stars 1.13k forks source link

Stetho leaks sockets causing app crash on Android 4.4 #669

Open gmk57 opened 4 years ago

gmk57 commented 4 years ago

This is probably the same issue as https://github.com/facebook/stetho/issues/308 - which is closed, and it seems nobody's going to reopen it. But it still exists in v1.5.1, 100% reproducible on emulator with an almost empty project.

Steps to reproduce:

  1. Create AVD with any API 19 image (x86, x86 + Google APIs, ARM...)
  2. Launch sample app
  3. Open chrome://inspect/#devices in Chrome
  4. After ~10 minutes Stetho reaches 1024 files/sockets and stops:
    W/System.err: java.io.IOException: Too many open files
    W/System.err:     at android.net.LocalSocketImpl.accept(Native Method)
    W/System.err:     at android.net.LocalSocketImpl.accept(LocalSocketImpl.java:328)
    W/System.err:     at android.net.LocalServerSocket.accept(LocalServerSocket.java:94)
    W/System.err:     at com.facebook.stetho.server.LocalSocketServer.listenOnAddress(LocalSocketServer.java:85)
    W/System.err:     at com.facebook.stetho.server.LocalSocketServer.run(LocalSocketServer.java:74)
    W/System.err:     at com.facebook.stetho.server.ServerManager$1.run(ServerManager.java:40)
    W/stetho: I/O error initialising connection thread
    I/stetho: Server shutdown on @stetho_gmk57.teststetho_devtools_remote
  5. After that, click on EditText in app. App crashes.