From: brent_despain@selinc.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13530: sort receives "unexpected out-of-memory situation during sort"
Date: Fri, 31 Jul 2015 22:06:18 +0000
Message-ID: <20150731220618.2987.1731@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 13530
Logged by: Brent DeSpain
Email address: brent_despain@selinc.com
PostgreSQL version: 9.3.4
Operating system: Ubuntu
Description:
We are occasionally receiving "unexpected out-of-memory situation during
sort". This happens mostly when we are running our version of pg_dump. It
returns the data from each table in primary key order. The amount of data
in each table is relatively small (< 100k in the larges tables). The error
is not predictably reproducible.
work_mem is set to 1536kB. Setting work_mem back to default seems to
decrease the occurrence of the error.
We did not have the problem reported in PostgreSQL 8.3.x.
<< Speculation >>
I have not contributed before to PostgreSQL so take this with a grain of
salt.
I reviewed the code and found that the error comes from
grow_memtuples(Tuplesortstate *state) in src\backend\utils\sort\tuplesort.c
or src\backend\utils\sort\tuplestore.c.
The problem seems to come from the new 9.x algorithm to grow memtupsize by
grow_ratio when doubling memtupsize is no longer possible.
It seems if we get really close to availMem the addition of the chunk header
returned by GetMemoryChunkSpace() pushes us over the edge and LACKMEM()
becomes TRUE.
This is my speculation.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: brent_despain@selinc.com
Subject: Re: BUG #13530: sort receives "unexpected out-of-memory situation during sort"
In-Reply-To: <20150731220618.2987.1731@wrigleys.postgresql.org>
References: <20150731220618.2987.1731@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox