getgauge 无法启动仪表 API:连接到 127.0.0.1 超时

getgauge Failed to start gauge API: Timed out connecting to 127.0.0.1

当 运行 在服务器中测量时,我们收到:

Failed to start gauge API: Timed out connecting to 127.0.0.1:46025

服务器在 /etc/hosts

中有 localhost 127.0.0.1

我曾尝试使用 nc 在同一端口启动一个虚拟侦听器,但失败了,我可以远程登录到它。

例如,如果我像这样启动一个 netcat 侦听器:

nc -l -p 46025

并从同一台服务器远程登录到它:

telnet 127.0.0.1 46025
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
sdlfkhsldfkj

我能够看到按键出现在侦听器中:

nc -l -p 46025
sdlfkhsldfkj
^C

这里有什么问题吗? 如何解决更多问题? 谢谢!

这是错误日志(运行 它在 Jenkins 管道中):

13:28:53 + gauge run --tags 1234 specs
13:29:25 Error ----------------------------------
13:29:25 
13:29:25 Failed to start gauge API: Timed out connecting to 127.0.0.1:36192
13:29:25 
13:29:25 Get Support ----------------------------
13:29:25    Docs:          https://docs.gauge.org
13:29:25    Bugs:          https://github.com/getgauge/gauge/issues
13:29:25    Chat:          https://gitter.im/getgauge/chat
13:29:25 
13:29:25 Your Environment Information -----------
13:29:25    linux, 1.0.5, 562f036
13:29:25    html-report (4.0.8), python (0.3.5), screenshot (0.0.1), xml-report (0.2.1)

原因:

出现如下错误 Failed to start gauge API: Timed out connecting to 127.0.0.1:{port_no} 当您的仪表 运行ner(套接字客户端)无法在超时期限内连接到您的仪表(套接字服务器)时发生。默认超时时间为 25sec 。 Gauge 创建两种类型的套接字服务器(GRPC 或 TCP)。

可能的原因:

  1. 您有大量规范或测试用例。

  2. 由于 25 秒是一个较长的时间段,因此系统可能没有足够的资源(CPU 利用率,RAM)在此时间段内进行连接。它可能发生在测试或开发环境中。如果您使用的是 docker 或 kubernetes,请检查您的容器或 pod 是否具有所需的资源。

  3. 如果您设置了enable_multithreading true 并且系统由于资源不足而无法支持它。

解决方案:

  1. 尽量运行单规格代替运行宁大号。命令指定的 gauge run {specs_dir}/{specs_fileName}.

  2. 运行命令gauge config runner_connection_timeout {timeInMillisecs}gauge config runner_request_timeout {timeInMillisecs}增加超时。 例如:仪表配置 runner_connection_timeout 40000 将超时设置为 40 秒。

  3. env/default/default.properties文件中设置enable_multithreading=false

注意:如果没有设置端口,则为客户端分配随机空闲端口进行连接,您可以通过设置环境变量 GAUGE_PORT={portNo} 和 GAUGE_INTERNAL_PORT={portNo} 在这种情况下,两个 portNo 应该相同。