Re: autovacuum launcher process eating up 17G+ of ram?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nick <t32(at)2thebatcave(dot)com>, Kevin Grittner <kevin(dot)grittner(at)wicourts(dot)gov>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: autovacuum launcher process eating up 17G+ of ram?
Date: 2010-11-08 15:01:51
Message-ID: 1289227352-sup-6579@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Excerpts from Tom Lane's message of lun oct 25 16:57:10 -0300 2010:

> It looks to me like the problem is that get_database_list()
> intentionally pushes its result into a long-lived context, and then the
> result is never cleaned up. It doesn't help any that it does a lot of
> leaky things like heap_beginscan with CurrentMemoryContext totally
> unnecessarily pointing at the long-lived context.
>
> I'm not sure what the intent was here, but it's pretty broken as-is.
> Alvaro, what did you have in mind? Should this be using a less
> long-lived context, or do we need code to free an avw_dbase list?

Sorry for not noticing this earlier. Seems my mail filters are broken
:-( Thanks Tom for the ping via private email.

Yes, get_database_list is clearly broken as is. I don't remember why
it's coded like this; this memcxt shuffling was introducing in the 9.0
rewrite to read pg_database directly instead of the flat file.

The right way for it to work seems to be to allocate the output list in
the caller's context; both current callers are in a throwaway context and
so the allocated list will go away automatically when they're done with
the list.

Patch for this is attached (applies cleanly to 9.0 and HEAD; 8.4 doesn't
need to be patched, but I'll run the test case now just to be sure.)

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
0001-Fix-permanent-memory-leak-in-autovacuum-launcher.patch application/octet-stream 2.8 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2010-11-08 15:05:24 Re: Forced quiesce
Previous Message Vladimir Rusinov 2010-11-08 12:16:40 Splunk for PostgreSQL