Re: Is there any problem with pg_notify and memory consumption? - Mailing list pgsql-general

From Per-Olov Esgard
Subject Re: Is there any problem with pg_notify and memory consumption?
Date
Msg-id OFEF9CEF74.631A212F-ONC125789D.005910DB-C125789D.005910DF@micronic-mydata.com
Whole thread Raw
In response to Re: Is there any problem with pg_notify and memory consumption?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is there any problem with pg_notify and memory consumption?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
<font face=3D"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=
=3D"2">Thank you very much for your fast answers (both Tom and Merlin)=
, I really appreciate it.=0DDo I have to send a proper bug repor=
t for this?=0DWe have this problem in our product now, so I volu=
nteer to test a patch  :-)=0D =0DBest regar=
ds,=0DPer-Olov Esg=E5rd-----To=
m Lane <tgl@sss.pgh.pa.us> wrote: ----- =0D=0D<BLOC=
KQUOTE style=3D"BORDER-LEFT: black 2px solid; PADDING-LEFT: 5px; PADDING-RI=
GHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">To: Per-Olov Esgard <Per-=
Olov.Esgard@micronic-mydata.com>From: Tom Lane <tgl@sss.pgh.pa.us=
>Date: 05/27/2011 05:28PMCc: Merlin Moncure <mmoncure@gmail.c=
om>, pgsql-general@postgresql.orgSubject: Re: [GENERAL] Is there any=
 problem with pg_notify and memory consumption?<FONT size=3D2 face=
=3D"Default Monospace,Courier New,Courier,monospace">Per-Olov Esgard <Pe=
r-Olov.Esgard@micronic-mydata.com> writes:> This is my setup:=
> - linux kernel 2.6.20.16 in a custom OS installation based on Fedora C=
ore > 3, yes I know, stone age :-)> - memory 512 MB> -=
 swap 512 MB> - cpu p4 2.8 GHz - single core - no hyper threading<BR=
>> - db encoding UTF-8> - client encoding default Latin-1 (Linux =
client) but UTF-8 used for > Windows clients > - postgresql.c=
onf is attached as well as the environment variables> - we  bui=
ld the postgres server ourselves and the dev env is the same as > th=
e target env  (no cross compilation).Hah, I replicated the pro=
blem.  Here is what's going on: the main loopin PostgresMain is in=
tended to do its work in MessageContext.  But ifProcessCompletedNo=
tifies does any work, it exits withCurrentMemoryContext having been res=
et to TopMemoryContext duringtransaction commit.  This means any m=
emory that the main loop doesn'tbother to explicitly free during the ne=
xt command cycle will get leaked.The reason we haven't noticed this see=
ms to be that the only case whereany such memory does get leaked is if =
we have to do encoding conversionon the incoming command.  Also, t=
he bug has only been there since 9.0.I think the right fix is to ma=
ke sure that ProcessCompletedNotifiessaves and restores the call-time C=
urrentMemoryContext.regards, tom lane=
=0DThe information contained in this communication and any attachm=
ents may be confidential and privileged, and is for the sole use of the int=
ended recipient(s). If you are not the intended recipient, you are hereby f=
ormally notified that any unauthorized review, use, disclosure or distribut=
ion of this message is prohibited. Please notify the sender immediately by =
replying to this message and destroy all copies of this message and any att=
achments. Micronic Mydata is neither liable for the proper and complete tra=
nsmission of the information contained in this communication, nor for any d=
elay in its receipt.

pgsql-general by date:

Previous
From: Gaetano Giunta
Date:
Subject: adding applications to the stack builder
Next
From: Merlin Moncure
Date:
Subject: Re: Is there any problem with pg_notify and memory consumption?