Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9B03F633426 for ; Sun, 20 Sep 2009 07:08:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 59654-04 for ; Sun, 20 Sep 2009 10:08:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from serenity.inversion.ee (serenity.inversion.ee [194.204.33.112]) by mail.postgresql.org (Postfix) with ESMTP id 2A74D632238 for ; Sun, 20 Sep 2009 07:08:27 -0300 (ADT) Received: by serenity.inversion.ee (Postfix, from userid 108) id 2263CE345D2; Sun, 20 Sep 2009 12:02:14 +0300 (EEST) Received: from [IPv6:::1] (localhost [127.0.0.1]) by serenity.inversion.ee (Postfix) with ESMTP id 2C3F3E34450; Sun, 20 Sep 2009 12:02:13 +0300 (EEST) Subject: Re: OOM on large SELECT From: Hannu Krosing To: Angelo Nicolosi Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: <4AB100D7.60805@opencloud.com> <4AB112C3.1050809@hogranch.com> Content-Type: text/plain Date: Sun, 20 Sep 2009 13:08:23 +0300 Message-Id: <1253441303.9470.22.camel@hvost1700> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=AWL=0.001, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/35 X-Sequence-Number: 19982 On Thu, 2009-09-17 at 19:03 +0200, Angelo Nicolosi wrote: > Sorry for the delay of this answer but i was trying to figure out. > However I saw that the memory that the postgres is using is getting > larger step by step. > So it doesn't free it. If the memory is allocated using palloc() and not freed even after the query finishes, then you must be using a wrong memory context. > After the third query it is already full and one of the thread of the > postgres is killed from the OOM. > When the process is killed the program usually is going to call again > a stored function. > By the way the info that you required me are: > > > postgres (PostgreSQL) 8.4.0 > Linux kernel 2.6.18 64bits > > > For the memory settings I have to contact the system admin because i > don't have the rights, on that machines, to read the configurations > file. do show work_mem; from psql; to see all conf params, do show all; > Thank you again to all for your help. > Cheers, > Angelo. > > > Date: Wed, 16 Sep 2009 09:30:59 -0700 > > From: pierce@hogranch.com > > To: amenuor@hotmail.com > > CC: pgsql-jdbc@postgresql.org > > Subject: Re: [JDBC] OOM on large SELECT > > > > Angelo Nicolosi wrote: > > > It's possible that the problem is in my C code but every time that > I'm > > > allocating memory, using always the palloc() function, I'm always > > > calling the pfree(). > > > There is some way to analyze the code meanwhile is working inside > the > > > Postgre server (something like valgrind)? > > > However the command free -m on my machine outputs: > > > > > > total used free shared buffers cached > > > Mem: 2010 664 1345 0 157 383 > > > -/+ buffers/cache: 123 1886 > > > Swap: 16386 41 16345 > > > > > > I think that the swap is enough. > > > Could you give me some tips about how can I see where is the > problem? > > > Thank you for your help! > > > > do you know what query you were making when you ran out of memory? > it > > -appears- it was a postgres server process that was OOM'd. > > > > what OS and version are you on (OOM seems to imply its likely > linux, > > since no other OS I'm familiar with would randomly kill processes > like > > that), what version postgres, etc ? > > > > also, what are the various memory settings in your postgresql.conf > > (shared_buffers, work_mem, etc) > > > > > > > > ______________________________________________________________________ > Una risposta istantanea? Usa Messenger da Hotmail -- Hannu Krosing http://www.2ndQuadrant.com PostgreSQL Scalability and Availability Services, Consulting and Training