Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9bffaad

Browse files
committed
Fixes:
This is a patch to prevent an endless loop occuring in the Postgres backend when a 'warning' error condition generates another warning error contition in the handler code. Submitted by: Chris Dunlop, <chris@onthe.net.au>
1 parent 64bfa04 commit 9bffaad

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/backend/tcop/postgres.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.2 1996/07/15 19:22:17 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.3 1996/07/19 06:13:42 scrappy Exp $
1111
*
1212
* NOTES
1313
* this is the "main" module of the postgres backend and
@@ -111,6 +111,7 @@ jmp_buf Warn_restart;
111111
#else
112112
sigjmp_buf Warn_restart;
113113
#endif /*defined(WIN32) || defined(PORTNAME_next) */
114+
int InWarn;
114115

115116
extern int NBuffers;
116117

@@ -1203,6 +1204,7 @@ PostgresMain(int argc, char *argv[])
12031204
#else
12041205
if (setjmp(Warn_restart) != 0) {
12051206
#endif /* WIN32 */
1207+
InWarn = 1;
12061208

12071209
time(&tim);
12081210

@@ -1213,14 +1215,15 @@ PostgresMain(int argc, char *argv[])
12131215

12141216
AbortCurrentTransaction();
12151217
}
1218+
InWarn = 0;
12161219

12171220
/* ----------------
12181221
* POSTGRES main processing loop begins here
12191222
* ----------------
12201223
*/
12211224
if (IsUnderPostmaster == false) {
12221225
puts("\nPOSTGRES backend interactive interface");
1223-
puts("$Revision: 1.2 $ $Date: 1996/07/15 19:22:17 $");
1226+
puts("$Revision: 1.3 $ $Date: 1996/07/19 06:13:42 $");
12241227
}
12251228

12261229
/* ----------------

src/backend/utils/error/elog.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.2 1996/07/16 07:13:47 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.3 1996/07/19 06:13:58 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -150,13 +150,16 @@ elog(int lev, char *fmt, ... )
150150
#endif /* !PG_STANDALONE */
151151

152152
if (lev == WARN) {
153+
extern int InWarn;
153154
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
155+
if (!InWarn) {
154156
#ifndef WIN32
155-
kill(getpid(), 1); /* abort to traffic cop */
156-
pause();
157+
kill(getpid(), 1); /* abort to traffic cop */
158+
pause();
157159
#else
158-
longjmp(Warn_restart, 1);
160+
longjmp(Warn_restart, 1);
159161
#endif /* WIN32 */
162+
}
160163
/*
161164
* The pause(3) is just to avoid race conditions where the
162165
* thread of control on an MP system gets past here (i.e.,

0 commit comments

Comments
 (0)