Re: Escaping from blocked send() reprised.

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alex Shulgin <ash(at)commandprompt(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Escaping from blocked send() reprised.
Date: 2015-01-10 01:59:07
Message-ID: 20150110015907.GE12509@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-11-17 18:22:54 +0300, Alex Shulgin wrote:
>
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> >
> > I've invested some more time in this:
> > 0002 now makes sense on its own and doesn't change anything around the
> > interrupt handling. Oh, and it compiles without 0003.
>
> In this patch, the endif appears to be misplaced in PostgresMain:
>
> + if (MyProcPort != NULL)
> + {
> +#ifdef WIN32
> + pgwin32_noblock = true;
> +#else
> + if (!pg_set_noblock(MyProcPort->sock))
> + ereport(COMMERROR,
> + (errmsg("could not set socket to nonblocking mode: %m")));
> + }
> +#endif
> +

Uh. Odd. Anyway, that bit of code is now somewhere else anyway...

> One thing I did try is sending a NOTICE to the client when in
> ProcessInterrupts() and DoingCommandRead is true. I think[1] it was
> expected to be delivered instantly, but actually the client (psql) only
> displays it after sending the next statement.

Yea, that should be psql specific though. I hope ;)

> While I'm reading on FE/BE protocol someone might want to share his
> wisdom on this subject. My guess: psql blocks on readline/libedit call
> and can't effectively poll the server socket before complete input from
> user.

I'm not sure if it's actually a "can't". It doesn't at least ;)

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2015-01-10 02:19:44 Re: Fixing memory leak in pg_upgrade
Previous Message Jim Nasby 2015-01-10 01:19:09 Re: Updating copyright notices to 2015 for PGDG