Re: What is happening on buildfarm member baiji? - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: What is happening on buildfarm member baiji?
Date
Msg-id 87wszbbg6i.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: What is happening on buildfarm member baiji?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>>> What happens if we just "#ifndef WIN32" the setsockopt(SO_REUSEADDR)
>>> call?  I believe the reason that's in there is that some platforms will
>>> reject bind() to a previously-used address for a TCP timeout delay after
>>> a previous postmaster quit, but if that doesn't happen on Windows then
>>> maybe all we need is to not set the option.
>
>> Well it's worth checking. But whereas Windows breaking our understanding of
>> what SO_REUSEADDR does doesn't actually violate any specification, not having
>> a TIME_WAIT state at all would certainly violate the TCP spec. So it's
>> somewhat unlikely that that's what they're doing. But anything's possible.
>
> This is not a behavior required by the TCP spec AFAICS.  Also, in a
> quick test neither Linux nor HPUX appear to need SO_REUSEADDR --- on
> both, I can restart the postmaster immediately without it.

It certainly is, observe on page 55 of RFC 793 for the "Open" call in the
example API:

TIME-WAIT STATE
     Return "error:  connection already exists".


> so the fact is that that code has undergone approximately 0 specific
> peer review.  I'm beginning to wonder if we really need it at all.
> I thought I recalled us having discussed the need for it once, but I
> cannot find any trace of such a discussion.

It's certainly standard in Unix coding to have the server set SO_REUSEADDR and
the client not set it.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Aidan Van Dyk
Date:
Subject: Re: What is happening on buildfarm member baiji?
Next
From: Tom Lane
Date:
Subject: Re: What is happening on buildfarm member baiji?