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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn
Date: 2013-06-27 13:48:25
Message-ID: 19850.1372340905@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2013-06-26 20:07:40 -0400, Tom Lane wrote:
>> 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(dot)49635(dot)565990(dot)716645(at)kryten(dot)bedford(dot)waii(dot)com#14855(dot)49635(dot)565990(dot)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.

That's only in the backend though: note the #define is controlled by
#ifndef FRONTEND, and we don't link backend/port/win32/socket.c into
libpq anyway. The signal managing it's doing wouldn't work at all in
client-side programs.

But yeah, on the backend side we would definitely treat WSAEINPROGRESS
as a hard error. OTOH, we don't use nonblocking connect (much?) in the
backend so I'm not sure whether that's a directly comparable case or
not.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-06-27 13:50:32 Re: Move unused buffers to freelist
Previous Message Andres Freund 2013-06-27 13:22:42 Re: Min value for port