为什么使用ESTABLISHED和TIME_WAIT与同一个仿真器端口进行如此多的连接 [英] why so many connection to same Emulator port with ESTABLISHED and TIME_WAIT

查看:315
本文介绍了为什么使用ESTABLISHED和TIME_WAIT与同一个仿真器端口进行如此多的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Android Studio时,我正在努力寻找解决项目中两个永久性错误的方法

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)

无论我使用哪个Android/API版本,这两个错误都不会消失.我发现与该端口的仿真器连接数有些奇怪.也许它是按这种方式工作的,或者我弄砸了一些东西,却找不到什么(我已经安装并从头开始重新安装Android Studio,并且仍然存在相同的问题)

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)

这是事件日志

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.

当我运行应用程序时,错误消息仿真器:socketTcpLoopbackClientFor:错误:FD_SETSIZE(32768)上方的fd 60252"不断弹出.

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.

在这里,我认为很奇怪

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>

所以我的直接问题是:为什么到5037的ESTABLISHED和TIME_WAIT连接这么多?

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

一些有用的评论可能会帮助我前进:Android Studio是否真的需要在启动过程中以及在运行/调试应用程序之前使用该端口?仅在调试时启动守护程序的任何技巧(作为一个糟糕的类比,在Spring Boot中进行编码时,我们不会使TomCat一直保持运行状态).我不明白为什么我在启动Android Studio之后立即收到此消息守护程序未运行;现在从tcp: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.

推荐答案

作为直到现在我发现的唯一合理答案,我部分基于

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

看来,仿真器的多核CPU可能是一个问题.因此,只需取消选中Avd Manager之后的多核CPU->选择仿真器->编辑->高级设置->多核CPU->取消选中此选项

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

这篇关于为什么使用ESTABLISHED和TIME_WAIT与同一个仿真器端口进行如此多的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆