On Tue, Dec 13, 2016 at 9:49 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2016-12-12 16:46:38 +0900, Michael Paquier wrote:
>> OK, I think that I have spotted an issue after additional read of the
>> code. When a WSA event is used for read/write activity on a socket,
>> the same WSA event gets reused again and again. That's fine for
>> performance reasons
>
> It's actually also required to not loose events,
> i.e. correctness. Windows events are edge, not level triggered.
>
Are all Windows events edge triggered? What I read from msdn [1], it
doesn't appear so. I am quoting text from msdn page [1] which seems
to be saying the event FD_READ we use in this case is level triggered.
"For FD_READ, FD_OOB, and FD_ACCEPT network events, network event
recording and event object signaling are level-triggered."
> The
> previous implementation wasn't correct. So just resetting things ain't
> ok.
>
Okay, but I think we need to re-enable the existing event handle for
required event (FD_READ) by using WSAEventSelect() to make it work
sanely. We have tried something on those lines and it resolved the
problem. Ashutosh will post a patch on those lines later today. Let
us know if you have something else in mind.
[1] - https://msdn.microsoft.com/en-us/library/windows/desktop/ms741576(v=vs.85).aspx
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com