Bug related to out of memory condition

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Bug related to out of memory condition
Date: 2006-10-24 02:03:07
Message-ID: 1161655387.18892.29.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

This behavior exists in 8.1.4 and CVS HEAD.

I list below my preexisting schema, a set of commands that behave as I
expect (and result in an ERROR), and a similar set of commands that do
not behave as I expect (and result in a PANIC). Note the position of
"BEGIN" in each.

This is quite finicky behavior. Apparently the columns in the "crashme"
table have a significant effect on the results. If you have trouble
reproducing this, I can give more system details. However, it behaves
this way on a fresh install of CVS HEAD, and it's 100% reproducible (for
me, anyway).

Regards,
Jeff Davis

------- EXISTING SCHEMA -------------

CREATE TABLE r1( i INT PRIMARY KEY );
INSERT INTO r1 VALUES(1);
CREATE TABLE r2( i INT PRIMARY KEY );
INSERT INTO r2 VALUES(1);
CREATE TABLE r3( i INT PRIMARY KEY );
INSERT INTO r3 VALUES(1);
CREATE TABLE r4( i INT PRIMARY KEY );
INSERT INTO r4 VALUES(1);

First, here is the correct behavior:

-------- CORRECT BEHAVIOR -----------

crashme=> CREATE TABLE crashme (
crashme(> attr1 SERIAL8 PRIMARY KEY,
crashme(> attr2 TIMESTAMPTZ DEFAULT NOW(),
crashme(> attr3 TIMESTAMPTZ,
crashme(> attr4 INT REFERENCES r1(i),
crashme(> attr5 INT REFERENCES r2(i),
crashme(> attr6 INT REFERENCES r3(i),
crashme(> attr7 INT REFERENCES r4(i),
crashme(> attr8 TEXT
crashme(> );
NOTICE: CREATE TABLE will create implicit sequence "crashme_attr1_seq"
for serial column "crashme.attr1"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"crashme_pkey" for table "crashme"
CREATE TABLE
crashme=> BEGIN;
BEGIN
crashme=> INSERT INTO crashme
(attr1,attr2,attr3,attr4,attr5,attr6,attr7,attr8) SELECT NEXTVAL
('crashme_attr1_seq'),NOW(),NOW(),1,1,1,1,'t1' FROM generate_series
(1,5000000);
ERROR: out of memory
DETAIL: Failed on request of size 32.
crashme=>

----------- UNEXPECTED BEHAVIOR ------------------

crashme=> BEGIN;
BEGIN
crashme=> CREATE TABLE crashme (
crashme(> attr1 SERIAL8 PRIMARY KEY,
crashme(> attr2 TIMESTAMPTZ DEFAULT NOW(),
crashme(> attr3 TIMESTAMPTZ,
crashme(> attr4 INT REFERENCES r1(i),
crashme(> attr5 INT REFERENCES r2(i),
crashme(> attr6 INT REFERENCES r3(i),
crashme(> attr7 INT REFERENCES r4(i),
crashme(> attr8 TEXT
crashme(> );
NOTICE: CREATE TABLE will create implicit sequence "crashme_attr1_seq"
for serial column "crashme.attr1"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"crashme_pkey" for table "crashme"
CREATE TABLE
crashme=> INSERT INTO crashme
(attr1,attr2,attr3,attr4,attr5,attr6,attr7,attr8) SELECT NEXTVAL
('crashme_attr1_seq'),NOW(),NOW(),1,1,1,1,'t1' FROM generate_series
(1,5000000);
WARNING: AbortTransaction while in ABORT state
WARNING: AbortTransaction while in ABORT state
WARNING: AbortTransaction while in ABORT state
ERROR: out of memory
DETAIL: Failed on request of size 32.
ERROR: out of memory
DETAIL: Failed on request of size 27.
ERROR: out of memory
DETAIL: Failed on request of size 27.
ERROR: out of memory
DETAIL: Failed on request of size 27.
ERROR: out of memory
DETAIL: Failed on request of size 24.
PANIC: ERRORDATA_STACK_SIZE exceeded
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-10-24 02:39:13 Re: BUG #2701: PQserverVersion function missing
Previous Message Thomas H. 2006-10-23 22:26:50 Re: BUG #2712: could not fsync segment: Permission

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-10-24 03:39:34 Replication documentation addition
Previous Message Alvaro Herrera 2006-10-24 01:22:50 Re: [PATCHES] smartvacuum() instead of autovacuum