]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Ensure "still waiting on lock" message is logged only once per wait.
authorFujii Masao <fujii@postgresql.org>
Mon, 16 Mar 2026 09:10:57 +0000 (18:10 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 16 Mar 2026 09:10:57 +0000 (18:10 +0900)
commitfd6ecbfa75ff0316f17c75d3931f20eb4f6e1231
treea5f4d49134aa53aa4700252160ee084488267273
parentc336133c65a7ac3223a3cb492b8bbf4fa3999375
Ensure "still waiting on lock" message is logged only once per wait.

When log_lock_waits is enabled, the "still waiting on lock" message is normally
emitted only once while a session continues waiting. However, if the wait is
interrupted, for example by wakeups from client_connection_check_interval,
SIGHUP for configuration reloads, or similar events, the message could be
emitted again each time the wait resumes.

For example, with very small client_connection_check_interval values
(e.g., 100 ms), this behavior could flood the logs with repeated messages,
making them difficult to use.

To prevent this, this commit guards the "still waiting on lock" message so
it is reported at most once during a lock wait, even if the wait is interrupted.
This preserves the intended behavior when no interrupts occur.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hüseyin Demir <huseyin.d3r@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHZUmg+r4kMcPYt_Z-txxVX+CJJhfra+qemxKXvAxYbpw@mail.gmail.com
src/backend/storage/lmgr/proc.c