Re: [PATCH] LWLock self-deadlock detection

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] LWLock self-deadlock detection
Date: 2020-11-29 06:16:13
Message-ID: X8M8rU4qqcuhnmlf@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)iki(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-11-29 06:23:18 Re: parallel distinct union and aggregate support patch
Previous Message Michael Paquier 2020-11-29 06:06:51 Re: Online verification of checksums