Re: BUG #15076: postmaster crashes unexpectedly when using up arrowkey in psql command - Mailing list pgsql-bugs

From Magnus Hagander
Subject Re: BUG #15076: postmaster crashes unexpectedly when using up arrowkey in psql command
Date
Msg-id CABUevEw0Za=f0fDHKBE26fj5Qhbo0fzWyhf8FDe-8qtD3QPU7Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15076: postmaster crashes unexpectedly when using up arrow key in psql command  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #15076: postmaster crashes unexpectedly when using up arrowkey in psql command  (趙明春 <mzhao@insight-tec.co.jp>)
List pgsql-bugs


On Thu, Feb 22, 2018 at 4:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
趙明春 <mzhao@insight-tec.co.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. 


--

pgsql-bugs by date:

Previous
From: "Kolla, Mahesh"
Date:
Subject: RE: BUG #15078: Unable to receive data from WAL Stream Error
Next
From: "Kolla, Mahesh"
Date:
Subject: RE: BUG #15078: Unable to receive data from WAL Stream Error