Fixed pg_class refcache leak when the meta tuple in pg_class in invalid.

Started by Ming Liover 9 years ago3 messageshackers
Jump to latest
#1Ming Li
mli@apache.org

Hi all,

In some cases the meta tuple in pg_class for a specific relation is
invalid, which will cause relcache leak, and then report warning:
WARNING: relcache reference leak: relation "pg_class" not closed.

The diff file in the attachment can fix this problem.

Attachments:

pg_class_relcache_leak.difftext/plain; charset=US-ASCII; name=pg_class_relcache_leak.diffDownload+4-0
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ming Li (#1)
Re: Fixed pg_class refcache leak when the meta tuple in pg_class in invalid.

Ming Li <mli@apache.org> writes:

In some cases the meta tuple in pg_class for a specific relation is
invalid, which will cause relcache leak, and then report warning:
WARNING: relcache reference leak: relation "pg_class" not closed.

The diff file in the attachment can fix this problem.

I'm confused. RelationBuildDesc doesn't open pg_class and shouldn't
be responsible for closing it either; both of those things happen in
ScanPgRelation, leaving no apparent scope for a leak such as you suggest.
Moreover, there's no variable named pg_class_relation in this whole file,
so your patch wouldn't even compile.

Could you show us a test case that provokes the warning you see?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#2)
Re: Fixed pg_class refcache leak when the meta tuple in pg_class in invalid.

On Sat, Nov 26, 2016 at 8:57 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Could you show us a test case that provokes the warning you see?

Nothing to worry about IMO. Looking at the patch, there is no
pg_class_relation declared, so this would not even compile...
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers