RED icon indicating copy to clipboard operation
RED copied to clipboard

Test Runner Agent: connection failed, Unable to open socket to localhost, Errno 10061 Connection Refused

Open pmandayam opened this issue 7 years ago • 15 comments

With the RED plugin, I am getting the error listed below when I run Robot tests. This error occurs before the tests are run. The tests can be run successfully despite the error coming up.

The RED eclipse plugin tries to connect to the live message log; it tries a total of 10 times (10 trials), and when it fails to connect on each trial, it outputs the following message in the Eclipse console:

TestRunnerAgent: connection trial #[trial number] failed
	Unable to open socket to "localhost:58160"
	error: [Errno 10061] Connection refused

Here is my system configuration:

Operating system: 64 bit Windows 10 Python interpret type: Jython 2.7.0. Robot Framework version: 3.0.2 (I believe). We are using Robot maven plugin 1.4.7. RED Plugin version: 0.8.3.

Robot tests are run with a custom made batch script which contains these commands:

@ECHO OFF
SETLOCAL enabledelayedexpansion

SET "removePath=Src.Test.Resources.Robot."
SET man1=%1
SET man2=%2

SHIFT & SHIFT

:loop
IF NOT "%1"=="" (
    IF "%1"=="--listener" (
        SET listener=%2
        SHIFT
    )
	IF "%1"=="-s" (
		SET suitesPath=%2
		SET "suites=!suitesPath:*%removePath%=!"
        SHIFT
    )
	IF "%1"=="-t" (
        SET tests=%2
		SET "tests=!tests:%suitesPath%.=!"
        SHIFT
    )
	IF "%1"=="-i" (
        SET "includes=%2,%includes%"
        SHIFT
    )
	IF "%1"=="-e" (
        SET excludes=%2,%excludes%
        SHIFT
    )
    SHIFT
    GOTO :loop
)

mvn -Dlistener=%listener% -Dsuites=%suites% -Dtests=%tests% -Dincludes=%includes% -Dexcludes=%excludes% generate-resources robotframework:run

:theend

My test case is as simple as this:

* Test Cases *
Test 1
	Log To Console	hi

pmandayam avatar Feb 09 '18 21:02 pmandayam

Hi Are you running this test with Robot Remote Run Configuration or with Robot with external script defined?

09.02.2018 22:44 "pmandayam" [email protected] napisał(a):

With the RED plugin, I am getting the error listed below when I run Robot tests. This error occurs before the tests are run. The tests can be run successfully despite the error coming up.

The RED eclipse plugin tries to connect to the live message log; it tries a total of 10 times (10 trials), and when it fails to connect on each trial, it outputs the following message in the Eclipse console:

TestRunnerAgent: connection trial #[trial number] failed Unable to open socket to "localhost:58160" error: [Errno 10061] Connection refused

Here is my system configuration:

Operating system: 64 bit Windows 10 Python interpret type: Jython 2.7.0. Robot Framework version: 3.0.2 (I believe). We are using Robot maven plugin 1.4.7. RED Plugin version: 0.8.3.

Robot tests are run with a custom made batch script which contains these commands:

@ECHO OFF SETLOCAL enabledelayedexpansion

SET "removePath=Src.Test.Resources.Robot." SET man1=%1 SET man2=%2

SHIFT & SHIFT

:loop IF NOT "%1"=="" ( IF "%1"=="--listener" ( SET listener=%2 SHIFT ) IF "%1"=="-s" ( SET suitesPath=%2 SET "suites=!suitesPath:*%removePath%=!" SHIFT ) IF "%1"=="-t" ( SET tests=%2 SET "tests=!tests:%suitesPath%.=!" SHIFT ) IF "%1"=="-i" ( SET "includes=%2,%includes%" SHIFT ) IF "%1"=="-e" ( SET excludes=%2,%excludes% SHIFT ) SHIFT GOTO :loop )

mvn -Dlistener=%listener% -Dsuites=%suites% -Dtests=%tests% -Dincludes=%includes% -Dexcludes=%excludes% generate-resources robotframework:run

:theend

My test case is as simple as this:

  • Test Cases * Test 1 Log To Console hi

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nokia/RED/issues/183, or mute the thread https://github.com/notifications/unsubscribe-auth/AD0H9dUxfk3gS4-qx0JZ6Zz3XKkiOKE5ks5tTLxRgaJpZM4SAkwX .

KrzysztofJozefowicz avatar Feb 10 '18 06:02 KrzysztofJozefowicz

I am running Robot tests by calling a maven goal, robotframework:run, which is part of the robot maven plugin. That maven command is in a custom made batch script I posted above.

pmandayam avatar Feb 10 '18 22:02 pmandayam

Hi What about case when you execute simple robot testcase without custom/external script? Have you changed anyting in "Listener" part of run configuration?

"Connection refused" tells that given port on given IP is closed - do you have a firewall/antivir installed which could block ports?

KrzysztofJozefowicz avatar Feb 12 '18 07:02 KrzysztofJozefowicz

+1 to this issue. I am facing this very same problem

moijes12 avatar Apr 03 '18 16:04 moijes12

Hi,

can you share any details? What's your environment? Have a look at questions asked above too.

michalanglart avatar Apr 04 '18 06:04 michalanglart

Let me copy&paste questions which were not answered since 12 FEB: What about case when you execute simple robot testcase without custom/external script? Have you changed anyting in "Listener" part of run configuration?

"Connection refused" tells that given port on given IP is closed - do you have a firewall/antivir installed which could block ports?

KrzysztofJozefowicz avatar Apr 04 '18 07:04 KrzysztofJozefowicz

Closing as it doesn't seem to occur. Please reopen or open new issue if facing this problem

michalanglart avatar Oct 10 '18 07:10 michalanglart

TestRunnerAgent: connection trial #1 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #2 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #3 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #4 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #5 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #6 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #7 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #8 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #9 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it
TestRunnerAgent: connection trial #10 failed
	Unable to open socket to "localhost:52564"
	error: [Errno 10061] No connection could be made because the target machine actively refused it

> pip show robotframework
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: robotframework
Version: 3.1.1
Summary: Generic automation framework for acceptance testing and robotic process automation (RPA)
Home-page: http://robotframework.org
Author: Pekka Klärck
Author-email: [email protected]
License: Apache License 2.0
Location: c:\python27\lib\site-packages

Windows 10, Python2.7

How to reopen this issue?...

lucky62 avatar Jan 27 '21 13:01 lucky62

I guess you cannot reopen issues not raised by you. Do you have any logs in metadata/.log file?

michalanglart avatar Jan 27 '21 13:01 michalanglart

metadata.log Log attached. If you need more info, tell me, please...

Note: .log renamed to metadata.log

lucky62 avatar Jan 27 '21 15:01 lucky62

What about antiviruses or firewalls? From log it seems there is some connectivity issue as there are exceptions from Eclipse itself when it tries to look for updates.

Have you tried launching RED as an administrator?

I cannot see anything related to tests launching. Can you try to launch tests and see if that causes new exceptions in .log file?

Also: you seem to have broken red.xml file:

The end-tag for element type "isLibrariesAutoDiscoveringSummaryWindowEnabled" must end with a '>' delimiter.

Moreover this tag is no longer used for at least couple of RED versions (support removed in April 2018) but RED should detect that and automatically convert your file. You should try to fix the syntax and restart RED - it should ask you for red.xml update. Alternatively you may need to setup the file from scratch.

michalanglart avatar Jan 28 '21 13:01 michalanglart

Most probably this will be a Firewall issue. However I cannot to check. My PC is managed by my company. I cannot view the settings nor log files of firewall (Symantec Endpoint Protection). Running the RED as an Administrator was not helpful.

lucky62 avatar Feb 02 '21 19:02 lucky62

I do have Symantec Endpoint Protection on my machine too, although probably set up differently.

Anyway: can you try launch Remote session as described here: https://nokia.github.io/RED/help/user_guide/launching/remote_launch.html

When launching the tests "normally" RED does two things:

  1. Setup a server which listens for connection from our TestRunnerAgent.py execution listener
  2. Launches tests execution with the listener attached so that it can connect to the server and then sends data about ongoing tests execution.

Remote session is very similar although the second part has to be done manually from command line. When launching Remote Session RED will establish the server and will wait for you to launch the tests with TestRunnerAgent.py so that it would connect. The disadvantage is that you need to do something manually + you will not see what the tests process is printing to the console in RED Console View (because RED does not have handles to those streams as it is not launching them). The advantage is that with Remote debugging you should be able to launch the tests on different machine.

For our investigation here Remote session could be helpful - at least we would know if there is a problem with launching server or with connection between server and TestRunnerAgent.

michalanglart avatar Feb 02 '21 21:02 michalanglart

Hi, if this is still causing a problem it could be that the server connection is timing out before the agent has had time to connect. It by default is 30s which usually is fine but I have had times when for some reason it has taken longer...using a larger timeout value in the launch configuration fixed it for me when I had similar issues.

rechardr avatar Mar 17 '21 20:03 rechardr

I'm facing exact issue after clearing temp files from my local.. how to resolve it.. did i delete something that shouldn't be deleted..?

Hiccup23 avatar Aug 22 '23 03:08 Hiccup23