www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/05/15/05:04:59

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84653397A48B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1589533455;
bh=UMl2Hmg5x0ZjIv8BPy7pPN8c0inNdomFD+jaPuGzE6Q=;
h=To:References:In-Reply-To:Subject:Date:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=xS5EyMXfujiIm3BQUX1HaAIkBZeTzwRuJ90rVCWqIa+Buv2AnJd88SRIaOFAGtHbS
l006xPpkYKh1lEUEGS7Nw1cmGzMqJQfJ8i7+GDC7PQNx/5LAmT3o4WYPor8cvVJOrK
evDC0KlP5Aw2sYw7qO7Mqj+8Btel0QEl4q2VGZWY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F8263851C22
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:references:in-reply-to:subject:date
:message-id:mime-version:content-transfer-encoding:thread-index
:content-language;
bh=sncZ68epvI3p447RkWYFxDwKashagPQ1k2+UL4BEP/Y=;
b=cYzPvw0SIbBMTMvnLpHQidpX8uIGXOmyoZvyGq+3qkxdspqx1+rfqPS2gqe3AY+BDL
W4iaQFUG6vW0SjJSmqVEdcSlS/6DWeTo5HHrHCFL8PO9Srt0SBw9PmappM7R/2jU+TWH
4RFcukYYxH1v8YV7C7D/HxF5kZIybjgIBahHp5hwJm+OirhcQy2KsyCGZcgNuJbvZ1+r
8Do6X75DRUN5NPcNo0BrQKkiNDraGopxRtFPyz+70dGscRjXbk0s5CtfVXNd9p108whM
3heUh6jqEEZN3e8bxAm3exSVYbeq+VgrGvHEN+6OF0/HLigBxPse5+slNxjUzu8qYF+w
xTZA==
X-Gm-Message-State: AOAM5313RUbqBS6UBrWmt9ZKlOh/K+r8sOiMuzlUorvKq9cv5te67K5Y
qHRVWnd9BXEp7tpXSOjtptpwJ90k
X-Google-Smtp-Source: ABdhPJzkHeFnrRp+tw6dt2+wpLFjCe0PgybgfcbzPSif/85U5Ksa6I9Iyzy+98aFWWY7wEdB2zj3DQ==
X-Received: by 2002:a2e:96c2:: with SMTP id d2mr1664796ljj.214.1589533450691;
Fri, 15 May 2020 02:04:10 -0700 (PDT)
To: <cygwin AT cygwin DOT com>
References: <008001d62513$42ec3130$c8c49390$@gmail.com>
<20200508101015 DOT GI3947 AT calimero DOT vinschen DOT de>
In-Reply-To: <20200508101015.GI3947@calimero.vinschen.de>
Subject: Sv: ECONNABORTED and ECONNRESET on TCP socket using recv()
Date: Fri, 15 May 2020 11:04:09 +0200
Message-ID: <009f01d62a97$cba980c0$62fc8240$@gmail.com>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIaP9y2mMe8hVyfmpYJqEWtiRucOQNQ6vWTqAYej6A=
X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Kristian Ivarsson via Cygwin <cygwin AT cygwin DOT com>
Reply-To: sten DOT kristian DOT ivarsson AT gmail DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

> > 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.

The application is quite complex but I guess it won't count as a test-case
and we still fail to reproduce this in a simple manner


Looking at strace along with winsock-trace revealed a few mysterious though.
According to the strace there's a fork for every posix_spawnp, i.e. it seems
like two processes are created (the forked later exits) but they are somehow
tied to the same cygwin-pid. The weird thing is that one of the forked
"ghost-processes" gets a winsock-abort-event, so my take on this is that the
dup(lications) of socket-descriptors kind of transforms the ownership to the
wrong process or perhaps there's some premature release or such. The
"ghost-process" getting the winsock-abort-event are of a type that should
"inherit" the accept-socket and is called "client-child" in the description
above


The problems doesn't occur in the simplified test-case but if someone is
interested I can give guidance to help building/testing the more complex
test-cases


Does anyone have a clue of where we could find some more clues about this
and/or if something obvious come to someone's mind of how to proceed ?


There are some comments that might be related to this in the implementation
of fhandler_socket_inet::recv_internal() though the comments does not really
describe our scenario


Best regards,
Kristian




> > 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 ?

[snip] 

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019