Can not connect to swarm: Exception details: System.Net.Sockets.SocketException (0x80004005)

Currently I am not able to build the lighning on my machine anymore.
As soon as I start the build in the UE4 Editor it freezes with the window:
0:00:00 Starting up Swarm Connection (100%)

A look into the swarm logfile revealed this:

20:28:43: Starting up SwarmAgent ...
 20:28:43:  ... registering SwarmAgent with remoting service
 20:28:43:  ... registering SwarmAgent network channels
 20:28:43:  ... initializing SwarmAgent
 20:28:43:  ...... checking certificate
 20:28:43:  ......... certificate check has failed
 20:28:43:  ...... initializing cache
 20:28:43:  ......... using cache folder 'C:/Users/Lars/AppData/Local/UnrealEngine/4.11/Saved/Swarm/SwarmCache'
 20:28:43:  ......... recreating SwarmAgent cache staging area
 20:28:43:  ...... initializing connection to SwarmCoordinator
 20:28:43:  ......... using SwarmCoordinator on CRUNCHER3
 20:28:43: [PingRemoteHost] Successfully pinged CRUNCHER3 with CRUNCHER3
 20:29:02: [Ping] Communication with the coordinator failed, job distribution will be disabled until the connection is established
 20:29:02: Exception details: System.Net.Sockets.SocketException (0x80004005): Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte 192.168.0.10:8009
 Server stack trace: 
    bei System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
    bei System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(AddressFamily family)
    bei System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
    bei System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
    bei System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
    bei System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
 Exception rethrown at [0]: 
    bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    bei SwarmCoordinatorInterface.ISwarmCoordinator.Ping(AgentInfo UpdatedInfo)
    bei Agent.Agent.PingCoordinator(Boolean ForcePing)
 20:29:02:  ......... SwarmCoordinator failed to be initialized
 20:29:02:  ...... initializing local performance monitoring subsystem

I spent the weekend reinstalling Unreal Editor, Configuring, Resetting and completely disabling and switching the Settings of Kaspersky and the Windows Firewall but nothing helped.
The message persist. I tried different hosts like localhost or 127.0.0.1 and netstat -aon tells me that the coordinator is listening on port 8009 on my windows 10 machine.

But the error persists and I have to admint, that I am stuck.

Any Ideas?

I manged to get this solved by resetting my Kaspersky Settings to factory default und rebooting the PC.
Strange is, I did the same thing yesterday 192873 times and nothing happened. So I am not sure wether this is a solution or just a lucky coincidence.

Be advised that this may break some vital security settings. Don’t do this without asking your system administrator or the knowledge what you are doing! Don’t blame me! :slight_smile:

Now I have the issue again… and resetting kaspersky is not the solution.

Hey weberl,

Have you taken a look at the Swarm Agent Troubleshooting Guide to see if there are possible solutions for your issue?

Have you attempted to build the same project on a different machine not connected as a build farm?

Try increasing the verbosity of your logs to see if there is any other information to be obtained from your issue.

Thank you,

Hi Andrew,

I worked myself through the Swarm agent Trouble Shooting Guide and learned a lot. But I am affraight that the problem persists.
I also completely removed unreal and all it’s traces from my PC.

But I could narrow the problem down to one file: UnrealLightMass.exe
If I start this file from my explorer via double click I see the exact same error messages in the terminal window:

LogLightmass:Display: Lightmass Win64 started on: CRUNCHER3. Command-line:
Lightmass Win64 started on: CRUNCHER3. Command-line:
LogLightmass:Display: Processing scene GUID: 0000012300004567000089AB0000CDEF with 8 threads
Processing scene GUID: 0000012300004567000089AB0000CDEF with 8 threads
Building static lighting...
[OpenConnection] Registering TCP channel ...
[OpenConnection] Connecting to agent ...
[TryOpenConnection] Testing the Agent
LogSwarmInterface:Error: [TryOpenConnection] Waiting for the agent to start up ...
[TryOpenConnection] Waiting for the agent to start up ...
LogSwarmInterface:Error: System.Net.Sockets.SocketException (0x80004005): Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig 127.0.0.1:8008

Server stack trace:
   bei System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   bei System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   bei System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
   bei System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   bei System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   bei System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream)
   bei System.Runtime.Remoting.Channels.BinaryClientFormatterSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
   bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   bei NSwarm.IAgentInterfaceWrapper.MethodDelegate.EndInvoke(Hashtable& OutParameters, IAsyncResult result)
   bei NSwarm.FSwarmInterface.TryOpenConnection(FConnectionCallback CallbackFunc, IntPtr CallbackData, ELogFlags LoggingFlags)
System.Net.Sockets.SocketException (0x80004005): Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig 127.0.0.1:8008

The Important part is:
System.Net.Sockets.SocketException (0x80004005): Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig 127.0.0.1:8008

Which translates to:
An attempt was made to access a socket in a way forbidden by its access permissions. 127.0.0.1:8008

One could think that my Port 8008 and 8009 could be blocked.
But I disabled both Kaspersky and the Windows firewall - so they don’t interfere here.

I also had a look with netstat -aopn and saw, that the swarm Agent was listeing on 8008 (and not another process)
My guess is not this has something to do with the underlying dotnet framework.

As far as my research has gone I am not alone with this problem:

Just to make sure:

  • What does your C:\Windows\System32\drivers\etc\hosts file look like?
  • What kind of dotnet runtime do I need?
  • How can I check which Version of the C++ Redistributable runtime is installed? Which one do I need?

Any hint would be apreciated. :-))

Hi Andrew,

My answer was too long for a comment and now the answer is awaiting apporval by a moderator. Do you know what caused this need for aproval?

Greetings,
Lars

So the .Net framework 4.5 update can be obtained by following the link below.

https://www.microsoft.com/en-us/download/details.aspx?id=30653

The user states this resolved his issue, so try that out and see what results you get. To check what redistributables you have installed, you can go to the Add or Remove programs to view all of the currently installed redist.

I hope this helps resolve your issue!

The installation of .net Framework failed with the message that it’s already installed on my machine and can not be installed twice.
I try some more things and report back.

BTW: My current Swarm config looks like this:

So we have essentially reached a point where the issue seems to lie with Port Forwarding. Take a look at the post one of my team members helped another user with a very similar issue.

He mentions a free software tool which might be able to help you resolve your issue. This is honestly the extent of my knowledge with Swarm Agent, and the troubleshooting process. I wish I could offer more insight, but the application is not heavily documented, and sometimes errors occur which have no official/exact answer. It is going to take some diving into, a combination of settings, and a bit of Windows magic to get it to work as expected.

When you do find a resolution to your issue, we would greatly appreciate you sharing the process you took so we can document it as well. Let me know if you have other questions or additional comments.

Cheers,

I didn’t find a resoltion to my issue. I spent the last to nights bruteforce reinstalling my Windows10 and all its applications after nothing helped. Now I can create lightning again.

Things I did and which didn’t solve the situation:

  • Reinstalling Unreal
  • Uninstalling Kasperky
  • Disabling Windows Firewall
  • Disabling Windows Defender

I am sorry that I can’t tell any better news. But finaly I can go on. THX anyway!

Hi guys,
I’m new to the Editor and have the same problem. I don’t have much experience about portforwarding and things like these but I’m using a tool named “iNetfusion” wich combines two internet-connections to double my speed. Once I’ve started the vanilla version of WoW it crashed because of some connection problems. I had no idea why because it ran well all the time so I just stopped the service of iNetfusion and it worked. Now I got that error in ue4 and just googled about it and found your thread. After reading a bit and saw that problem with the localhost and the port I just stopped once again the iNetfusion service und swarm could connect to the coordinator without any problem.

Maybe u’r using the same tool or it may can give you a hint to solve your problem. Maybe u just download that iNetfusion thing an restart that service inside that program. (it is not directly a separate service installes by iNetfusion. That program just do something with your ports and so on.) U may just give it a try…

hope I could help anyway

Hi,
i ran into the same problem. Swarm Socket error. Seem port 8008/9 was busy nor availbable.

Solution for me:

  1. reset firewall settings
  2. use tcpview find swarm_hw process. Thats an service. Kill them.
  3. restart pc. reboot is often a good idea :wink:
  4. now starting swarm agent should be ok

Firewall should ask now again for your apps (UE4, Swarm etc.).

t.