【问题标题】:getgauge Failed to start gauge API: Timed out connecting to 127.0.0.1getgauge 无法启动仪表 API:连接到 127.0.0.1 超时
【发布时间】:2019-06-30 22:38:05
【问题描述】:

在服务器中运行仪表时,我们收到:

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从同一个服务器进入它:

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)

【问题讨论】:

    标签: getgauge


    【解决方案1】:

    原因:

    以下错误 Failed to start gauge API: Timed out connecting to 127.0.0.1:{port_no} 当您的仪表运行器(套接字客户端)无法在超时期限内连接到您的仪表(套接字服务器)时发生。仪表的默认超时时间是 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} 以增加超时。 例如:gauge config runner_connection_timeout 40000 将超时设置为 40 秒。

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

    注意:如果未设置端口,则为客户端分配一个随机空闲端口以进行连接,您可以通过设置环境变量 GAUGE_PORT={portNo} 和 GAUGE_INTERNAL_PORT={portNo} 来指定它,这两个端口号应该相同案例。

    【讨论】:

    • 谢谢!将超时设置为 5 分钟后,我们能够解决问题。这是我们使用的设置:gauge config runner_connection_timeout 300000
    最近更新 更多