Re: Undetected Deadlock

Michael Harris <harmic@gmail.com>

From: Michael Harris <harmic@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Simon Riggs <simon.riggs@enterprisedb.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-general@lists.postgresql.org
Date: 2022-02-09T23:50:04Z
Lists: pgsql-general
On Mon, 7 Feb 2022 at 09:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Do you want to try this and see if it actually adds any robustness with your buggy code?

Sorry for the delayed response, & thanks for the patch.

I wasn't able to test with our actual application because it could
take days for it to actually trigger the problem, so I tested it with
a simulation, which you can find here:

https://github.com/harmic/pg_almloss

With that simulation I could attach gdb to the backend and see that
signal_pending & signal_due_at were being reset in the expected way,
even when a missed interrupt was triggered.

I'm convinced your patch improves robustness under the scenario we saw.

Thanks again!

Cheers
Mike



Commits

  1. Make timeout.c more robust against missed timer interrupts.

  2. Improve timeout.c's handling of repeated timeout set/cancel.