Re: Some 9.5beta2 backend processes not terminating properly? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Some 9.5beta2 backend processes not terminating properly?
Date
Msg-id 20160102161440.sp6bgwzl24kxa5ye@alap3.anarazel.de
Whole thread Raw
In response to Re: Some 9.5beta2 backend processes not terminating properly?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 2016-01-02 16:20:58 +0100, Andres Freund wrote:
> I really right now can see only two somewhat surgical fixes:
>
> 1) We do a nonblocking or select() *after* registering our events. Both
>    in WaitLatchOrSocket() and waitforsinglesocket. Since select/poll are
>    explicitly level triggered, that should make us notice any events we
>    might have missed. select() appears to have been available for a fair
>    while.
>
> 2) We explicitly shutdown(SD_BOTH) the socket whenever we get a FD_CLOSE
>    object. I *think* this should trigger errors in WSArecv, WSAEventSelect
>    et al. Doesn't solve the problem that we might miss important events
>    though.
>
>
> Given 2) isn't a complete fix and I can't find reliable documentation
> since when shutdown() is supported I'm inclined to go with 1).


Attached is an attempt to blindly implement 1). It needs some further
polishing and thought, but I'd like to verify it actually fixes things
before investing more time in this.

Greetings,

Andres Freund

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Some 9.5beta2 backend processes not terminating properly?
Next
From: Bruce Momjian
Date:
Subject: Re: Welcome to 2016, time to run src/tools/copyright.pl