pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tristan Partin <tristan@neon.tech>
To: Gurjeet Singh <gurjeet@singh.im>
Cc: pgsql-hackers@postgresql.org
Subject: Re: psql not responding to SIGINT upon db reconnection
Date: Mon, 24 Jul 2023 12:09:05 -0500
Message-ID: <CUAKGWGPO8EZ.9YCLEP1X976O@gonk> (raw)
In-Reply-To: <CABwTF4ULmrh7v4oY2mjBEfj1LXU_3a10V30QxZfo1+10+z5=AQ@mail.gmail.com>
References: <CUAJJDVD8L61.2AH6VEEDMTXX3@gonk>
	<CABwTF4ULmrh7v4oY2mjBEfj1LXU_3a10V30QxZfo1+10+z5=AQ@mail.gmail.com>

On Mon Jul 24, 2023 at 12:00 PM CDT, Gurjeet Singh wrote:
> On Mon, Jul 24, 2023 at 9:26 AM Tristan Partin <tristan@neon.tech> wrote:
>
> > attached patch
>
> +        /*
> +         * Restore the default SIGINT behavior while within libpq.
> Otherwise, we
> +         * can never exit from polling for the database connection. Failure to
> +         * restore is non-fatal.
> +         */
> +        newact.sa_handler = SIG_DFL;
> +        rc = sigaction(SIGINT, &newact, &oldact);
>
>     There's no action taken if rc != 0. It doesn't seem right to
> continue as if everything's fine when the handler registration fails.
> At least a warning is warranted, so that the user reports such
> failures to the community.

If we fail to go back to the default handler, then we just get the 
behavior we currently have. I am not sure logging a message like "Failed 
to restore default SIGINT handler" is that useful to the user. It isn't 
actionable, and at the end of the day isn't going to affect them for the 
most part. They also aren't even aware that default handler was ever 
overridden in the first place. I'm more than happy to add a debug log if 
it is the blocker to getting this patch accepted however.

-- 
Tristan Partin
Neon (https://neon.tech)





view thread (43+ messages)  latest in thread

Message-ID: <CUAKGWGPO8EZ.9YCLEP1X976O@gonk>
Permalink:  ../CUAKGWGPO8EZ.9YCLEP1X976O@gonk/
Also on:    postgresql.org/message-id/CUAKGWGPO8EZ.9YCLEP1X976O@gonk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tristan@neon.tech, gurjeet@singh.im
  Subject: Re: psql not responding to SIGINT upon db reconnection
  In-Reply-To: <CUAKGWGPO8EZ.9YCLEP1X976O@gonk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox