Re: Some 9.5beta2 backend processes not terminating properly?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Shay Rojansky <roji(at)roji(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Some 9.5beta2 backend processes not terminating properly?
Date: 2016-01-02 16:14:40
Message-ID: 20160102161440.sp6bgwzl24kxa5ye@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
select.diff text/x-diff 2.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2016-01-02 17:00:36 Re: Welcome to 2016, time to run src/tools/copyright.pl
Previous Message Andres Freund 2016-01-02 15:20:58 Re: Some 9.5beta2 backend processes not terminating properly?