X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=EviPt6xS47HDUqSWYPqerVe/Lg0v/naUu3rizd8QYD3
	91ywOpdIviZhqUMQx1wnXME+kE3QhehPyT+BTvItsEUrdSljmUkN66vGCEKhBIUw
	I+8oGSiGmL9Bl5fkCEavMecAWFnAOWXlXjcYGg0RxIF6Zb6LUf6gT5eMGMcLFdbM
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=YMZKdDrqwH/YI/ci2rKQUvbSOHY=; b=e4E/qfAQRJnioAHyy
	iwnPHwpXSITpvooDzkKvvYel2YrGKlrDihUah0fTH75XmjFmT7i6QdPWt9vdE6Vh
	LVG3TtVbAgbCvk9XSwnjim2dlTWVVHi8NfWzjV73aloBtRtwUAcxfq27PnlRumS4
	v6Br2+0vBpBc3qGejmyLstcVRc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-we0-f173.google.com
X-Received: by 10.180.187.111 with SMTP id fr15mr25935089wic.57.1403528847904;        Mon, 23 Jun 2014 06:07:27 -0700 (PDT)
Message-ID: <53A82688.9010005@gmail.com>
Date: Mon, 23 Jun 2014 15:07:20 +0200
From: Marco Atzeri <marco.atzeri@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: getaddrinfo : Non-recoverable failure in name resolution
References: <53A81259.4080300@gmail.com> <20140623122510.GD1803@calimero.vinschen.de>
In-Reply-To: <20140623122510.GD1803@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes


On 23/06/2014 14:25, Corinna Vinschen wrote:
> Hi Marco,
>
> On Jun 23 13:41, Marco Atzeri wrote:

>>
>> 64 $ ./getaddrinfo_test-2_64
>> getaddrinfo: Non-recoverable failure in name resolution
>>
>>
>> Am I missing something ?
>> The second way is currently used on postgresql in several places,
>> but it seems to fail only for "127.0.0.1"
>
> I don't know why this only fails for "127.0.0.1".  But this is clearly a
> problem in the 64 bit Cygwin DLL.
>
> What happens is that the field ai_addrlen is defined as socklen_t in
> POSIX, but as size_t in the W32 API.  On 64 bit, socklen_t is 4 bytes
> while size_t is 8 bytes.  Setting all the hintp members manually (in
> contrast to calloc'ing it or memset'ing it to 0) leaves the 4 upper
> bytes of the ai_addrlen untouched.  This in turn leads to a high
> probability that ai_addrlen has an invalid value when entering Winsock's
> getsockopt.
>
> I'm really surprised this hasn't been hit before.  I'm going to fix that
> in Cygwin by setting the upper 4 bytes of ai_addrlen to 0 explicitely.

Probably we have seen already but not identified.

> For the time being, you might prepend
>
>    memset (&hintp, 0, sizeof hintp);
>
> to the code, prior to setting the elements manually.

I will wait next snapshot.
PostgreSQL 9.4 is still on Beta 1, so I am not in a hurry to release
a new version


> Thanks for the testcase.  Much appreciated,
> Corinna

Thanks for the solution
Marco

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

