ECONNABORTED and ECONNRESET on TCP socket using recv()

Corinna Vinschen corinna-cygwin@cygwin.com
Fri May 8 10:10:15 GMT 2020


On May  8 10:32, Kristian Ivarsson via Cygwin wrote:
> Hi all
> 
> Have anyone experienced getting ECONNABORTED and ECONNRESET on local TCP
> socket when using recv() ?
> 
> 
> We have a fairly complex application where it, amongst others, spawns child
> processes (using posix_spawnp)
> 
> This is a simplified scenario
> 
> - parent performs socket() + bind() + listen() to localhost
> - parent spawns a client-child process 
>   - client-child is doing socket() + connect() to localhost
>   - client-child is doing send()
>   - client-child is doing recv() and getting ECONNRESET
> 
> - parent performs accept()
> - parent spawns a server-child process
>   - server-child is doing recv() and getting ECONNABORTED
> 
> 
> According to strace, both of these errors originates from
> fhandler_socket_inet::recv_internal() (in my version it says line 1221)

The errors are generated by the called Windows function WSARecvFrom.
We'd need a reproducible testcase for this to allow debugging.

> Maybe there's some defect in our application (there's a lot of other fuzz
> going on as well), but it works in several Linux-implementations but this
> error is deterministically occurring using CYGWIN
> 
> 
> I've searched mail archives but I cannot really find any explanation or
> cause
> 
> Does anyone have any knowledge about this ?
> 
> 
> 
> Best regards
> Kristian
> 
> p.s.
>    strace -f works in the opposite way as in most Linux-implementation btw
> (as far as I understand)

It's a toggle, multiple -f on the cli will switch it multiple times.
The fact that the default is to follow forks is pretty old, commit
f69af9b3d2352 from 2002.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


More information about the Cygwin mailing list