Re: ERROR: invalid memory alloc request size - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: ERROR: invalid memory alloc request size
Date
Msg-id 20051027141601.GD880@surnet.cl
Whole thread Raw
In response to Re: ERROR: invalid memory alloc request size  (Matteo Beccati <php@beccati.com>)
Responses Re: ERROR: invalid memory alloc request size
List pgsql-hackers
Matteo Beccati wrote:

> #2  0x0827b5cf in MemoryContextAlloc (context=0x856bcc8, 
> size=4278026492) at mcxt.c:505
>         __func__ = "MemoryContextAlloc"
> #3  0x080b6a16 in GetMultiXactIdMembers (multi=320306, xids=0xbfbfaba4) 
> at multixact.c:935
>         pageno = 156
>         prev_pageno = 156
>         entryno = 819
>         slotno = 2
>         offptr = (MultiXactOffset *) 0x286536ac
>         offset = 4235201
>         length = -4235201
>         i = 138425096
>         nextMXact = 320308
>         tmpMXact = 320307
>         nextOffset = 4235265
>         ptr = (TransactionId *) 0xbfbfab78

Whoa.  length = *offptr - offset, which means that the datum stored at
offptr is 0.  I think the problem is that CreateMultiXactId calls
GetNewMultiXactId and then RecordNewMultiXact, and the lock is released
between the calls.  So one backend could try to read the offset before
another one had the time to finish writing it.

-- 
Alvaro Herrera                           Developer, http://www.PostgreSQL.org
"No single strategy is always right (Unless the boss says so)"                                                 (Larry
Wall)


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ERROR: invalid memory alloc request size
Next
From: Matteo Beccati
Date:
Subject: Re: ERROR: invalid memory alloc request size