BUG #18053: fastpath count per pid in pg_locks shows > 16 entries

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: hi+postgresql(at)yamlcoder(dot)me
Subject: BUG #18053: fastpath count per pid in pg_locks shows > 16 entries
Date: 2023-08-10 12:31:04
Message-ID: 18053-c80f1cbe77bed71f@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18053
Logged by: Maxim Ivanov
Email address: hi+postgresql(at)yamlcoder(dot)me
PostgreSQL version: 15.2
Operating system: Linux
Description:

my understanding that fastpath locking is limited to 16 locks, but when
querying live system there are pids with 17 or sometimes even 18 fastpath
locks:

```
select pid, count(case when fastpath then 1 end) as num_fastpath_locks from
pg_locks where locktype = 'relation' group by pid having count(case when
fastpath then 1 end) > 16;
pid | num_fastpath_locks
--------+--------------------
476053 | 17
490499 | 17
493405 | 17
495253 | 17
500332 | 17
500336 | 17
501218 | 17
````

Here is a full list of locks for one of those pids:

```
with locks as materialized (
select * from pg_locks
) select * from locks join (select pid, count(case when fastpath then 1
end) as num_fastpath_locks from locks where locktype = 'relation' group by
pid having count(case when fastpath then 1 end) > 16 limit 1) v on
(locks.pid = v.pid);
locktype | database | relation | page | tuple | virtualxid |
transactionid | classid | objid | objsubid | virtualtransaction | pid |
mode | granted | fastpath | waitstart | pid |
num_fastpath_locks
---------------+----------+-----------+------+-------+--------------+---------------+---------+-------+----------+--------------------+--------+------------------+---------+----------+-----------+--------+--------------------
relation | 31097292 | 31097661 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097646 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097631 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097616 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097601 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097586 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097571 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097556 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097541 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097526 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097511 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097496 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097481 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097466 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097451 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097436 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | t | | 478235 |
17
relation | 31097292 | 31097436 | | | |
| | | | 256/12671598 | 478235 |
RowExclusiveLock | t | t | | 478235 |
17
virtualxid | | | | | 256/12671598 |
| | | | 256/12671598 | 478235 |
ExclusiveLock | t | t | | 478235 |
17
relation | 31097292 | 31097871 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097721 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097706 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097676 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097841 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097556 | | | |
| | | | 256/12671598 | 478235 |
RowExclusiveLock | t | f | | 478235 |
17
relation | 31097292 | 31097691 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097736 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097766 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
transactionid | | | | | |
2587561133 | | | | 256/12671598 | 478235 |
ExclusiveLock | t | f | | 478235 |
17
relation | 31097292 | 31097811 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097916 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097826 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097781 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097856 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097796 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097751 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097901 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 334256066 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
relation | 31097292 | 31097886 | | | |
| | | | 256/12671598 | 478235 |
AccessShareLock | t | f | | 478235 |
17
```

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2023-08-10 23:22:48 Re: BUG #17928: Standby fails to decode WAL on termination of primary
Previous Message Bruce Momjian 2023-08-10 11:25:51 Re: BUG #18034: Accept the spelling "+infinity" in datetime input is not accurate