Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn
Дата
Msg-id 20130627061757.GB8025@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2013-06-26 20:07:40 -0400, Tom Lane wrote:
> > I don't see how we could trigger the conditions for EINPROGRESS on
> > windows that msdn lists, but since we need it on unixoid systems and its
> > valid to treat the connect as partiall successfull on windows, there
> > seems little benefit in dropping it.
> I was about to argue for removing the EINPROGRESS check on Windows,
> on the grounds that this would be the same type of bug as you're
> complaining of on Linux, ie, if the call does return this error we'll
> mistakenly think the connection is in progress and go on to deliver an
> unhelpful failure message later.

> However, some more trolling of the intertubes suggests that Cygwin's
> emulation of socket() does indeed return EINPROGRESS; see for instance
> this ancient thread of ours:
>
http://www.postgresql.org/message-id/flat/14855.49635.565990.716645@kryten.bedford.waii.com#14855.49635.565990.716645@kryten.bedford.waii.com
> Unless we want to distinguish Cygwin from native Windows in this code
> chunk, maybe we'd better leave well enough alone.

After some looking it gets funnier. There currently doesn't seem to be
any chance that we actually can get an EINPROGRESS at that level on
windows. We #define connect() to pgwin32_connect() which fudges errno
around. Where WSAEINPROGRESS is mapped to EINVAL.

Also for some reason the connect is performed synchronously to the
outside by doing pgwin32_waitforsinglesocket() if EWOULDBLOCK is
returned by connect()...
That seems to be the case since
a4c40f140d23cefbf94e00283f7688c772867f1b.

> I still want to delete the test for SOCK_ERRNO == 0.  I traced that back
> to commit da9501bddb42222dc33c031b1db6ce2133bcee7b, but I can't find
> anything in the mailing list archives to explain that.  I have an
> inquiry in to Jan to see if he can remember the reason ...

That looks strange, yes.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: 'Andres Freund'
Дата:
Сообщение: Re: Review: Patch to compute Max LSN of Data Pages
Следующее
От: Rushabh Lathia
Дата:
Сообщение: Re: proposal 9.4 plpgsql: allows access to call stack from GET DIAGNOSTICS statement