pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18331: Why is the session lock (DEFAULT_LOCKMETHOD) not automatically released during process exit?
2+ messages / 2 participants
[nested] [flat]

* BUG #18331: Why is the session lock (DEFAULT_LOCKMETHOD) not automatically released during process exit?
@ 2024-02-05 07:28  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2024-02-05 07:28 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: dafoer_x@163.com

The following bug has been logged on the website:

Bug reference:      18331
Logged by:          Why is the session lock (DEFAULT_LOCKMETHOD) not automatically released
during process exit?
Email address:      dafoer_x@163.com
PostgreSQL version: 16.1
Operating system:   centos_x86
Description:        

I have some doubts about the implementation of session locks. Can you help
me clarify my questions?

The comment for the function LockRelationIdForSession mentions “It will be
removed  when UnlockRelationIdForSession() is called, or if an
ereport(ERROR) occurs,  or if the backend exits.”
However, the callback function ShutdownPostgres, which is triggered during
process exit, only cleans up locks of type USER_LOCKMETHOD. Is it possible
to automatically clean up session locks of type DEFAULT_LOCKMETHOD?

What risks or implications would there be if session locks of type
USER_LOCKMETHOD were automatically cleaned up during process exit?



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18331: Why is the session lock (DEFAULT_LOCKMETHOD) not automatically released during process exit?
@ 2024-02-05 16:04  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2024-02-05 16:04 UTC (permalink / raw)
  To: dafoer_x@163.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> The comment for the function LockRelationIdForSession mentions “It will be
> removed  when UnlockRelationIdForSession() is called, or if an
> ereport(ERROR) occurs,  or if the backend exits.”
> However, the callback function ShutdownPostgres, which is triggered during
> process exit, only cleans up locks of type USER_LOCKMETHOD. Is it possible
> to automatically clean up session locks of type DEFAULT_LOCKMETHOD?

I think you are looking in the wrong place.  Normal locks are released
in the transaction-ending code.  We need the special case in
ShutdownPostgres because that's not true for user locks.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-02-05 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 07:28 BUG #18331: Why is the session lock (DEFAULT_LOCKMETHOD) not automatically released during process exit? PG Bug reporting form <noreply@postgresql.org>
2024-02-05 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox