1

I am struggling to find some way to deal with two permanent errors in my project when using Android Studio

Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037

Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)

No matter which Android/API version I use these two erros don't disapear. I find a bit weird the number of Emulator Connections to such port. Maybe it is desinged to work that way or maybe I messed upp some thing and I can't find what (I have unistall and reinstall Android Studio from scratch and same issue persist)

Here are the Event Log

01/06/2020
00:08   Gradle sync started
00:08   * daemon not running; starting now at tcp:5037
00:08   * daemon started successfully
00:08   Gradle sync finished in 2 s 418 ms (from cached state)
00:08   Executing tasks: [:app:assembleDebug] in project C:\WSs\FireStoreDemos\AppFirestore
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Gradle build finished in 19 s 659 ms
00:08   Install successfully finished in 584 ms.: App restart successful without requiring a re-install.

And the error "Emulator: socketTcpLoopbackClientFor: error: fd 60252 above FD_SETSIZE (32768)" keeps poping up a lot every minute while I am running the application.

And here what I consider strange

C:\Users>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54631        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54643        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54647        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54648        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54649        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54650        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54662        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54663        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54665        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54666        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54667        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54668        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54669        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54670        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54672        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54674        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54631        127.0.0.1:5037         ESTABLISHED     5224
  TCP    127.0.0.1:54634        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54636        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54639        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54641        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54643        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54671        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54673        127.0.0.1:5037         ESTABLISHED     348

C:\Users>

So my straight question is: why so many ESTABLISHED and TIME_WAIT connections to 5037?

Some usefull comments that might help me to move forward: does Android Studio really needs to use such port during startup and before I run/debug the application? Any trick to only start the Daemon when debugging (as a poor analogy we don't keep TomCat up running all time when coding in Spring Boot). I can't understand why I get this message "daemon not running; starting now at tcp:5037" immediatly after started Android Studio since I didn't start to effectivelly use of the Emulator neither by run nor by debug yet.

Jim C
  • 3,957
  • 25
  • 85
  • 162
  • 1
    I am experiencing the same problem(updated AS 4.0) – Hasan Khan Jun 01 '20 at 04:03
  • 1
    I am also having the same problem, which persists everytime I try to run a project, and due to this, the emulator is not running the app. Any updates on the solution? – Shrey Tripathi Jun 03 '20 at 08:54
  • @Shrey, no. I am still stuck and because I am totally new to develop for Android I have no idea what check – Jim C Jun 03 '20 at 15:33
  • @HasanMohdKhan, although it doesn't answer my question "why so many coonection to same Emulator" you may find worth to look at https://android.stackexchange.com/questions/225579/emulator-sockettcploopbackclientfor-error-fd-62884-above-fd-setsize-32768 and https://stackoverflow.com/a/61931383/4148175 – Jim C Jun 03 '20 at 20:55
  • 1
    I solved it by updating sdk to latest version. But after some time it start giving me same error. – Hasan Khan Jun 04 '20 at 00:10

2 Answers2

1

As the only reasonable answer I found untill now, I am answering my own question partially based on other proposal

It seems it is somehow an issue with Multi-core CPU from emulators. So just uncheck Multi-core CPU following Avd Manager -> Select emulator -> edit -> Advanced Settings -> Multi-core CPU -> UNCHECK this option

Maybe in future someone can add a better explanation over here

Jim C
  • 3,957
  • 25
  • 85
  • 162
1
Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)

I have an AMD graphics card and got the same errors. ^^ I fixed it by going to AVD Manager - Select emulator - edit - Emulated Performance, Grahics: choose -> Software.

Xalandra
  • 11
  • 3