pipeace

ACE pipe open sometimes return error 10060 - "A connection attempt failed because the connected party did not properly respond"


The following call:

ACE_HANDLE handles[2];
ACE_Pipe pipe;
if (pipe.open(handles)==-1)
    T_OS_ELOG(ACE_OS::last_error());

Sometimes result in an error, and ACE_OS::last_error return the following string:

Error code: 10060. Error details: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 

I find it confusing since the error string and all the related docs / answers about it mention the remote party / peer not responding, but in my case I'm only trying to open a pipe and don't really have any peer yet.

Its not a firewall related issue (there's no firewall and nothing goes outside yet) and I'm pretty sure its not because I ran out of ports or something like that because in that case I'm getting "Only one usage of each socket address (protocol/network address/port) is normally permitted".

So what could cause this error?

(I run on windows btw)


Solution

  • Answering myself for future seekers: as Steve Huston mentioned, ACE_Pipe is implemented using TCP loopback socket on windows.

    TCP loopback get pretty low priority in window's scheduler, so when the system is too busy, opening loopback connections might randomly timeout, if there are too many higher-priority tasks waiting.

    An optional solution would be using fast-path sockets (https://blogs.technet.microsoft.com/wincat/2012/12/05/fast-tcp-loopback-performance-and-low-latency-with-windows-server-2012-tcp-loopback-fast-path/) or dropping sockets completely and using anonymous pipes instead (https://learn.microsoft.com/en-us/windows/desktop/ipc/anonymous-pipes).

    Unfortionately both options are not supported by ACE, so this will require implementing your own IPC instead of using ACE_Pipe. Also its not cross-platform.