mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Reset CurrentMemoryContext to TopMemoryContext at the beginning of error
cleanup, ie, as soon as we have caught the longjmp. This ensures that current context will be a valid context throughout error cleanup. Before it was possible that current context was pointing at a context that would get deleted during cleanup, leaving any subsequent pallocs in deep trouble. I was able to provoke an Assert failure when compiled with asserts + -DCLOBBER_FREED_MEMORY, if I did something that would cause an error to be reported by the backend large-object code, because indeed that code operates in a context that gets deleted partway through xact abort --- and CurrentMemoryContext was still pointing at it! Boo hiss.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.153 2000/04/28 05:07:34 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.154 2000/04/30 21:29:23 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -127,7 +127,6 @@ bool ExitAfterAbort = false;
|
|||||||
extern int NBuffers;
|
extern int NBuffers;
|
||||||
|
|
||||||
static bool EchoQuery = false; /* default don't echo */
|
static bool EchoQuery = false; /* default don't echo */
|
||||||
time_t tim;
|
|
||||||
char pg_pathname[MAXPGPATH];
|
char pg_pathname[MAXPGPATH];
|
||||||
FILE *StatFp = NULL;
|
FILE *StatFp = NULL;
|
||||||
|
|
||||||
@ -1453,7 +1452,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.153 $ $Date: 2000/04/28 05:07:34 $\n");
|
puts("$Revision: 1.154 $ $Date: 2000/04/30 21:29:23 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1473,7 +1472,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
|
|
||||||
if (sigsetjmp(Warn_restart, 1) != 0)
|
if (sigsetjmp(Warn_restart, 1) != 0)
|
||||||
{
|
{
|
||||||
time(&tim);
|
/* Make sure we are in a valid memory context */
|
||||||
|
MemoryContextSwitchTo(TopMemoryContext);
|
||||||
|
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
TPRINTF(TRACE_VERBOSE, "AbortCurrentTransaction");
|
TPRINTF(TRACE_VERBOSE, "AbortCurrentTransaction");
|
||||||
|
Reference in New Issue
Block a user