From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50898 invoked by alias); 29 Aug 2019 12:15:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50887 invoked by uid 89); 29 Aug 2019 12:15:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*r:2001, refused, his, our X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Aug 2019 12:15:45 +0000 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43A302BE94 for ; Thu, 29 Aug 2019 12:15:44 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id k15so1994150wrw.18 for ; Thu, 29 Aug 2019 05:15:44 -0700 (PDT) Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id a142sm3423198wme.2.2019.08.29.05.15.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Aug 2019 05:15:42 -0700 (PDT) Subject: Re: [PATCH] Fix PR win32/24284: tcp_auto_retry doesn't work in MinGW To: Sergio Durigan Junior , GDB Patches References: <20190827155013.31610-1-sergiodj@redhat.com> Cc: Bernhard Wodok , Paul Carroll From: Pedro Alves Message-ID: <64a05dd3-ad63-eb64-49b4-cbc5faf51824@redhat.com> Date: Thu, 29 Aug 2019 12:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190827155013.31610-1-sergiodj@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00642.txt.bz2 On 8/27/19 4:50 PM, Sergio Durigan Junior wrote: > This was reported by Bernhard Wodok, along with a patch to fix the > issue. I adjusted the patch a bit, and I'm submitting the patch on > his behalf. > > According to Bernhard, the issue can be reproduced by doing: > > 1. start gdb > 2. enter 'target remote :2345' > 3. observe that it throws a "connection refused" error immediately > instead of waiting and throwing a timeout error > > I.e., I believe it can be reproduced by our current tests, which is > why I'm not proposing any extra tests here (well, I don't use nor have > any Windows system to test this, so...). > > The problem happens because we call 'gdb_select' passing 0 as its > first argument, I assume this is from wait_for_connect? Please mention that above. Must be, because I just now noticed that gdb_usleep is now dead code. The comment in wait_for_connect is quite curious, kind of implies that this worked on Windows at some point: /* Use gdb_select here, since we have no file descriptors, and on Windows, plain select doesn't work in that case. */ n = gdb_select (0, NULL, NULL, NULL, &t); > --- a/gdb/mingw-hdep.c > +++ b/gdb/mingw-hdep.c > @@ -64,6 +64,17 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, > int num_ready; > size_t indx; > > + if (n == 0) > + { > + /* The MS API says that the first argument to > + WaitForMultipleObjects cannot be zero. That's we just use > + a regular Sleep here. */ The sentence: "That's we just use a regular Sleep here." is non-grammatical. Missing a "why" in "That's why" ? OK with that fixed. Thanks, Pedro Alves