Search code examples
getgauge

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


While running gauge in a server, we receive:

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

The server has localhost 127.0.0.1 in /etc/hosts

I have tried using nc to start a dummy listener in the same port gauge fails and I'm able to telnet to it.

For instance, if I start a netcat listener like this:

nc -l -p 46025

and telnet from the same server into it:

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

I am able to I see the keys appear in the listener:

nc -l -p 46025
sdlfkhsldfkj
^C

What can be wrong here? How can I troubleshoot more? thanks!

Here are the error logs (running it within a Jenkins pipeline):

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)

Solution

  • REASON:

    The following error Failed to start gauge API: Timed out connecting to 127.0.0.1:{port_no} occurs when your gauge runner (socket client) is unable to connect to your gauge (socket server) within the timeout period. The default timeout by gauge is 25sec . Gauge creates two type of socket server (GRPC or TCP).

    POSSIBLE CAUSE:

    1. You are having large number of specification or testcases.

    2. Since 25 sec is a longer period it might be possible that system is not having enough resources (CPU Utilisation, RAM) to connect within this time period. It can happen over test or dev environment. If you are using docker or kubernetes check if your container or pod is having the required resources.

    3. If you had set enable_multithreading true and system is unable to support it due to lack of resources.

    SOLUTIONS:

    1. Try to run single specification instead of running large no. of specification by command gauge run {specs_dir}/{specs_fileName}.

    2. Run command gauge config runner_connection_timeout {timeInMillisecs} and gauge config runner_request_timeout {timeInMillisecs} to increase the timeout . Ex: gauge config runner_connection_timeout 40000 will set timeout to 40sec.

    3. Set enable_multithreading=false in env/default/default.properties file.

    NOTE: If no port is set gauge assign a random free port for client to connect you can specify it by setting the environment variable GAUGE_PORT={portNo} and GAUGE_INTERNAL_PORT={portNo} both portNo should be same in this case.