MemoryContextAlloc: invalid request size 1934906735 - Mailing list pgsql-hackers

From D'Arcy J.M. Cain
Subject MemoryContextAlloc: invalid request size 1934906735
Date
Msg-id 20020826220404.E569F1C4E@druid.net
Whole thread Raw
Responses Re: MemoryContextAlloc: invalid request size 1934906735  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I have been getting the subject message ever since upgrading to 7.2.1.  I 
tried 7.2.2 with the same thing.  It seems to be related to my chkpass type 
(see contrib) as it only happens on tables with that type.  I tried it on a 
new database with a very simple table and still see it.  After compiling 
chkpass.c and running the SQL to create the type create a table with one 
field with chkpass type.  Add a number of rows, I did 24, then vacuum it.  
You get something similar to the above.  Sometimes you get "Memory exhausted 
in AllocSetAlloc(929654141)" instead and once in a while there is no error.

Given table x with field c as chkpass run "UPDATE x SET c = ':a';" on it.  
This never fails.  Now try UPDATE x SET c = 'a';" and let chkpass crypt the 
value.  This usually fails with one of the above messages.  The number is 
constant until you run the UPDATE again.

Somehow the value of the password string is polluting the size storage.  I 
know this because every time this happens, the first 2nd, 3rd and 4th bytes 
(after adjusting for endianness) of the integer are the 6th, 7th and 8th 
characters of the encrypted password.

I have another type which is built like this except that it is an indexable 
type and that doesn't seem to have any problem.  It is constructed the same 
way otherwise.  The palloc calls appear to be correct.  Can anyone see why 
this would suddenly be a problem?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Default privileges for new databases (was Re: Can't import
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: TODO Done. Superuser backend slot reservations