delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/05/22/09:27:38

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 569C8386F471
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1590154015;
bh=IenlVcHndYk4/s/pRA+nskXItsnktSurEWrm63GC5FQ=;
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=cD2WMKZ2euIhJEF57Wg0Fsk0ZpmNtRiry5AIqwWDY8iSSVgkzYk7Hgmy4UQV8aqla
q5v1RRWRQe3AY1Bh2XiKbqoVnbS1RLK5jMxU9D+XXn1+MbNqt9zYXt7rp7Krp6cmyU
gu+rLBZDiEYy/ePfrMVB+WUF/4bB46MLbuinEFx4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 13E2E3851C0C
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=536SLSugr45yE/c4o4/NaIL3Fm/QnojUtX4CSqkh3ig=;
b=qeuJYKtSjodev7bhKp2iBnkhvv8x3tOXbhcbJVs+gLw4sB3bvzRdl4BK2Jv0+fmPNv
7b/sTz2xrPMiqhbTfVYDUiCmqUn0toJzOvx0Z8PtGsmA0KmHqHLen+g96jUF5pXmyIPR
EhA5W0GEknw1t9M8FMxYuoDrLYTFKtPB7WwlDDi4aH2yCIRIk0+upfODMDVLYVb1o6zZ
b9RD6zt0toXhr3AxMo7+Qlajn4tqE5D6kPJv3VVpo6ytrjnZdcAQZmAdKw22SuKW/zGM
rdqznLtJjhE96NkVS42DubK6YTlshB9XShr2XxyQTbPZLG4zIii4ZkdDP8V4NcrYGY2W
CMGQ==
X-Gm-Message-State: AOAM533yrrM76suIjDMJRnWpubDThVTweX++mJ0bOSCKTBe56fO6bDEC
Nm/uGnk31Lw8xJsV1JrCoApvmNj7
X-Google-Smtp-Source: ABdhPJz3cTSj8U+/BjTqpq0qpvfB9Z4VYritY0yJJK9bXBtu2lxs6fyXc2JZ7hOEfpQosf+tQP6VRw==
X-Received: by 2002:a2e:a48a:: with SMTP id h10mr5108591lji.305.1590154010441;
Fri, 22 May 2020 06:26:50 -0700 (PDT)
To: <cygwin AT cygwin DOT com>
References: <008001d62513$42ec3130$c8c49390$@gmail.com>
<20200508101015 DOT GI3947 AT calimero DOT vinschen DOT de>
<009f01d62a97$cba980c0$62fc8240$@gmail.com>
In-Reply-To: <009f01d62a97$cba980c0$62fc8240$@gmail.com>
Subject: Sv: ECONNABORTED and ECONNRESET on TCP socket using recv()
Date: Fri, 22 May 2020 15:26:48 +0200
Message-ID: <00b201d6303c$a6298c00$f27ca400$@gmail.com>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIaP9y2mMe8hVyfmpYJqEWtiRucOQNQ6vWTAiM2Yg6oAFbJIA==
X-Spam-Status: No, score=-2.0 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

[snip]

We discovered this to be a defect in our own code due to the fact that some
parts assumed that struct linger always had two int's (but in CygWin it is
two short's

This was discovered due to a strace-debug-output 

  if (optlen == (socklen_t) sizeof (int))
    debug_printf ("setsockopt optval=%x", *(int *) optval);

in fhandler_socket_inet::setsockopt that in it self is kind of weird, i.e.
it seems like it assumes an int is passed just because optlen is of the same
size as an int (and struct linger happen to be just that, so ... it kind of
helped us :-)

Keep up the good work
Kristian

[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