Skip to content

Commit a0f8636

Browse files
committed
I've just seen what happens when the MEMORY_CONTEXT_CHECKING code fires
an error at end of transaction ... and I did *not* like it. Reduce ERROR to NOTICE so that this situation doesn't cause an infinite loop.
1 parent 614d951 commit a0f8636

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/backend/utils/mmgr/aset.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.34 2000/12/01 18:14:29 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.35 2000/12/05 23:40:36 tgl Exp $
1515
*
1616
* NOTE:
1717
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -719,7 +719,7 @@ AllocSetFree(MemoryContext context, void *pointer)
719719
/* Test for someone scribbling on unused space in chunk */
720720
if (chunk->requested_size < chunk->size)
721721
if (((char *) pointer)[chunk->requested_size] != 0x7E)
722-
elog(ERROR, "AllocSetFree: detected write past chunk end in %s %p",
722+
elog(NOTICE, "AllocSetFree: detected write past chunk end in %s %p",
723723
set->header.name, chunk);
724724
#endif
725725

@@ -793,7 +793,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
793793
/* Test for someone scribbling on unused space in chunk */
794794
if (chunk->requested_size < oldsize)
795795
if (((char *) pointer)[chunk->requested_size] != 0x7E)
796-
elog(ERROR, "AllocSetRealloc: detected write past chunk end in %s %p",
796+
elog(NOTICE, "AllocSetRealloc: detected write past chunk end in %s %p",
797797
set->header.name, chunk);
798798
#endif
799799

@@ -923,6 +923,10 @@ AllocSetStats(MemoryContext context)
923923
/*
924924
* AllocSetCheck
925925
* Walk through chunks and check consistency of memory.
926+
*
927+
* NOTE: report errors as NOTICE, *not* ERROR or FATAL. Otherwise you'll
928+
* find yourself in an infinite loop when trouble occurs, because this
929+
* routine will be entered again when elog cleanup tries to release memory!
926930
*/
927931
static void
928932
AllocSetCheck(MemoryContext context)
@@ -966,16 +970,16 @@ AllocSetCheck(MemoryContext context)
966970
* Check chunk size
967971
*/
968972
if (dsize > chsize)
969-
elog(ERROR, "AllocSetCheck(): %s: req size > alloc size for chunk %p in block %p",
973+
elog(NOTICE, "AllocSetCheck(): %s: req size > alloc size for chunk %p in block %p",
970974
name, chunk, block);
971975
if (chsize < (1 << ALLOC_MINBITS))
972-
elog(ERROR, "AllocSetCheck(): %s: bad size %lu for chunk %p in block %p",
976+
elog(NOTICE, "AllocSetCheck(): %s: bad size %lu for chunk %p in block %p",
973977
name, (unsigned long) chsize, chunk, block);
974978

975979
/* single-chunk block? */
976980
if (chsize > ALLOC_CHUNK_LIMIT &&
977981
chsize + ALLOC_CHUNKHDRSZ != blk_used)
978-
elog(ERROR, "AllocSetCheck(): %s: bad single-chunk %p in block %p",
982+
elog(NOTICE, "AllocSetCheck(): %s: bad single-chunk %p in block %p",
979983
name, chunk, block);
980984

981985
/*
@@ -984,14 +988,14 @@ AllocSetCheck(MemoryContext context)
984988
* can't check as easily...)
985989
*/
986990
if (dsize > 0 && chunk->aset != (void *) set)
987-
elog(ERROR, "AllocSetCheck(): %s: bogus aset link in block %p, chunk %p",
991+
elog(NOTICE, "AllocSetCheck(): %s: bogus aset link in block %p, chunk %p",
988992
name, block, chunk);
989993

990994
/*
991995
* Check for overwrite of "unallocated" space in chunk
992996
*/
993997
if (dsize > 0 && dsize < chsize && *chdata_end != 0x7E)
994-
elog(ERROR, "AllocSetCheck(): %s: detected write past chunk end in block %p, chunk %p",
998+
elog(NOTICE, "AllocSetCheck(): %s: detected write past chunk end in block %p, chunk %p",
995999
name, block, chunk);
9961000

9971001
blk_data += chsize;
@@ -1001,7 +1005,7 @@ AllocSetCheck(MemoryContext context)
10011005
}
10021006

10031007
if ((blk_data + (nchunks * ALLOC_CHUNKHDRSZ)) != blk_used)
1004-
elog(ERROR, "AllocSetCheck(): %s: found inconsistent memory block %p",
1008+
elog(NOTICE, "AllocSetCheck(): %s: found inconsistent memory block %p",
10051009
name, block);
10061010
}
10071011
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy