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

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

From
Ming Li
Date:
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.


Attachment
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



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

From
Michael Paquier
Date:
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