Re: [PATCH] LWLock self-deadlock detection - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] LWLock self-deadlock detection
Date
Msg-id X8M8rU4qqcuhnmlf@paquier.xyz
Whole thread Raw
In response to Re: [PATCH] LWLock self-deadlock detection  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Fri, Nov 27, 2020 at 11:08:49AM -0800, Peter Geoghegan wrote:
> On Fri, Nov 27, 2020 at 10:22 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> I've made the mistake of forgetting to release an LWLock many times,
>> leading to self-deadlock. And I just reviewed a patch that did that this
>> week [1]. You usually find that mistake very quickly when you start
>> testing though, I don't think I've seen it happen in production.
>
> +1. The fact that you don't get deadlock detection with LWLocks is a
> cornerstone of the whole design. This assumption is common to all
> database systems (LWLocks are generally called latches in the database
> research community, but the concept is exactly the same).

+1.

>> So yeah, I agree it's not worth spending cycles on this. Maybe it would
>> be worth it if it's really simple to check, and you only do it after
>> waiting X seconds. (I haven't looked at this patch at all)
>
> -1 for that, unless it's only for debug builds. Even if it is
> practically free, it still means committing to the wrong priorities.
> Plus the performance validation would be very arduous as a practical
> matter.

Looking at the git history, we have a much larger history of bugs that
relate to race conditions when it comes to LWLocks.  I am not really
convinced that it is worth spending time on this even for debug
builds, FWIW.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Online verification of checksums
Next
From: Dilip Kumar
Date:
Subject: Re: parallel distinct union and aggregate support patch