Re: backend dies suddenly after a lot of error messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mirko(dot)kaffka(at)interface-business(dot)de
Cc: pgsql-general(at)postgreSQL(dot)org, psql-patches(at)postgreSQL(dot)org
Subject: Re: backend dies suddenly after a lot of error messages
Date: 1999-05-14 01:16:14
Message-ID: 14059.926644574@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mirko Kaffka <mirko(at)interface-business(dot)de> wrote:
> We have problems with backend processes that close the channel because of
> palloc() failures. When an INSERT statement fails, the backend reports an
> error (e.g. `Cannot insert a duplicate key into a unique index') and
> allocates a few bytes more memory. The next SQL statement that fails
> causes the backend to allocate more memory again, etc. until we have no
> more virtual memory left. Is this a bug?
> We are using postgres 6.4.2 on FreeBSD 2.2.8.

I have found the primary cause of memory leakage after an error ---
basically, the backend forgets to free *any* of the temporary memory
allocated up to the point of the error :-(. If your applications tend
to provoke many SQL errors then you will see a backend process that eats
up more and more memory until it hits your local system's process size
limit, whereupon it crashes.

I have repaired this problem in the 6.5 development sources. Attached
is a patch for 6.4.2, which I suggest you apply if this sounds like a
problem you are having.

The patch does not completely eliminate memory leaks after errors, but
they seem to be reduced to the few-hundred-bytes-per-error range instead
of the kilobytes (potentially lots of kilobytes) range. I am working on
curing the problem more completely for 6.5.

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 1.3 KB

Browse pgsql-general by date

  From Date Subject
Next Message Doo Suk Yang 1999-05-14 02:41:09 Re: [GENERAL] How to express categorized items in relational tables
Previous Message Brian 1999-05-13 22:54:35 postgres getting slow