Re: BUG #15076: postmaster crashes unexpectedly when using up arrow key in psql command

From: 趙明春 <mzhao(at)insight-tec(dot)co(dot)jp>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15076: postmaster crashes unexpectedly when using up arrow key in psql command
Date: 2018-02-23 02:16:36
Message-ID: CAGwivJEL+6EqNdsXP+UbK_Dp+dLpfOqxJhXSvNm6wm5dKK_3=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi, Tom and Magnus,

Thanks for your information for this issue.

> AFAIC Windows has no way to disassociate a process with a console window
in a similar way.

Can this be a solution for this issue to add an option
CREATE_NEW_PROCESS_GROUP to CreateProcess() function into pg_ctl.exe to
start postgres.exe process?

> I will say though that most people run the postmaster as a background
service on Windows, rather than launching it manually.

Unfortunately, we also met this issue, with poor reproducibility, when we
running the postmaster as Windows Service.
Maybe this is another story than launching it manually by pg_ctl.exe.
I will update you if I get any new information.

BEST,

-----------------------------------------------------------------------------------
Insight Technology, Inc. Mingchun Zhao, 趙 明春(チョウ メイシュン)
EbisBusinessTower 5F, 1-19-19, Shibuya-ku, Tokyo
TEL : +81-3-5475-1452 FAX : +81-3-5475-1451
Email : mzhao(at)insight-tec(dot)co(dot)jp WWW : http://www.insight-tec.com
-----------------------------------------------------------------------------------

2018-02-23 4:35 GMT+09:00 Magnus Hagander <magnus(at)hagander(dot)net>:

>
>
> On Thu, Feb 22, 2018 at 4:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> =?UTF-8?B?6LaZ5piO5pil?= <mzhao(at)insight-tec(dot)co(dot)jp> writes:
>> > So, Let me change my question:
>> > If I started the PostgreSQL by pg_ctl command in the same Windows
>> command
>> > prompt,
>> > Is it possible that pressing Ctrl + C on psql to break query(not
>> session)
>> > will send SIGINT to postmaster process unexpectedly?
>>
>> I don't know much about Windows signal processing, but the log entries you
>> show certainly look like that's what happened.
>>
>
> Yes, this is unfortunately exactly how it works on Windows.
>
> There is on way to intercept the Ctrl-C and have it not delivered to *all*
> processes out of the same session. It can only be added or removed for the
> current process (which psql does). So it gets delivered to the backends
> which call pg_console_handler, which emulates SIGINT.
>
>
> On Unix-ish machines it's normal for control-C to send a SIGINT to every
>> process that's in the terminal's process group --- *not* just the
>> foreground process. So if you launch the postmaster manually you'd better
>> make sure that it gets dissociated from the terminal, or you're at risk
>> of killing it accidentally. (Or, if you want to leave it connected to
>> that terminal, you use another window to run psql etc.) It seems that
>> something similar is happening on your Windows setup. I don't know
>> the rules for process/terminal association on Windows, so I can't suggest
>> what's the right way to do it. I will say though that most people
>> run the postmaster as a background service on Windows, rather than
>> launching it manually.
>>
>
> AFAIC Windows has no way to disassociate a process with a console window
> in a similar way.
>
>
> --
> Magnus Hagander
> Me: https://www.hagander.net/ <http://www.hagander.net/>
> Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-02-23 03:14:49 BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Previous Message Peter Geoghegan 2018-02-23 00:22:47 Re: PostgreSQL crashes with SIGSEGV