Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)
Date
Msg-id 20150203202811.GA12566@awork2.anarazel.de
Whole thread Raw
In response to Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On 2015-02-03 22:17:22 +0200, Heikki Linnakangas wrote:
> On 02/03/2015 08:54 PM, Andres Freund wrote:
> >* Previously the patchset didn't handle SIGTERM while
> >   InteractiveBackend() was reading from the client. It did handle
> >   ctrl-c/d, but since getc() isn't interruptible and can't be replaced
> >   with latches... The fix for that isn't super pretty:
> >   die():
> >       if (DoingCommandRead && whereToSendOutput != DestRemote)
> >        ProcessInterrupts();
> >   but imo acceptable for single user mode.
> 
> That smells an awful lot like ImmediateInterruptOK.

It awfully does, yes. But we're only exiting, and only in single user
mode. And only during command read. We don't need all the other
complicated stuff around sinval, async, deadlock checking, etc.

> Could you use WaitLatchOrSocket to sleep on stdin?

Unfortunately I don't think so. poll() etc only works properly on
network handles, pipes etc - but stdin can be a file :(. And I think
what exactly happens if it's a file fd isn't super well defined. On
linux the file is always marked as ready, which would probably actually
work...

I think this is better solved in the long run to get rid of single user
mode, akin to the patch Tom had a year or two back. Adding more
complications for it doesn't seem worth it.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)
Next
From: Josh Berkus
Date:
Subject: Re: Redesigning checkpoint_segments