Re: Latch-ifying the syslogger process

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgresql.org
Date: 2012-05-13T00:48:52Z
Lists: pgsql-hackers
I wrote:
> While testing this I discovered a pre-existing bug in the Unix
> implementation of WaitLatchOrSocket: EOF on the socket is reported as
> POLLHUP not POLLIN (at least on my Linux box), which results in
> WaitLatchOrSocket going into an infinite loop, because poll() returns
> immediately but the result bitmask never becomes nonzero.

BTW, I just came across this in Microsoft's documentation of
WSAEventSelect:

	Note that Windows Sockets will record only an FD_CLOSE network event
	to indicate closure of a virtual circuit. It will not record an
	FD_READ network event to indicate this condition.

which seems to me to indicate that the Windows version of
WaitLatchOrSocket has a related bug.  We want socket EOF to result in
WL_SOCKET_READABLE being returned, no?  Otherwise the caller may never
realize that it has an EOF condition to deal with.

			regards, tom lane