Re: Get memory contexts of an arbitrary backend process
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: torikoshia <torikoshia@oss.nttdata.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Georgios Kokolatos <gkokolatos@protonmail.com>,
Kasahara Tatsuhito <kasahara.tatsuhito@gmail.com>, craig@2ndquadrant.com
Date: 2021-03-05T05:22:56Z
Lists: pgsql-hackers
On 2021/03/04 18:32, torikoshia wrote: > On 2021-01-14 19:11, torikoshia wrote: >> Since pg_get_target_backend_memory_contexts() waits to dump memory and >> it could lead dead lock as below. >> >> - session1 >> BEGIN; TRUNCATE t; >> >> - session2 >> BEGIN; TRUNCATE t; -- wait >> >> - session1 >> SELECT * FROM pg_get_target_backend_memory_contexts(<pid of session >> 2>); --wait >> >> >> Thanks for notifying me, Fujii-san. >> >> >> Attached v8 patch that prohibited calling the function inside transactions. > > Regrettably, this modification could not cope with the advisory lock and > I haven't come up with a good way to deal with it. > > It seems to me that the architecture of the requestor waiting for the > dumper leads to this problem and complicates things. > > > Considering the discussion printing backtrace discussion[1], it seems > reasonable that the requestor just sends a signal and dumper dumps to > the log file. +1 Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION
Commits
-
Add function to log the memory contexts of specified backend process.
- 43620e328617 14.0 landed
-
Add pg_backend_memory_contexts system view.
- 3e98c0bafb28 14.0 cited
-
Limit the verbosity of memory context statistics dumps.
- 7b5ef8f2d070 9.6.0 cited