Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53e95ee

Browse files
committed
Fix for rare race-condition-like failure: if a backend receives SIGUSR2
(notify/SI-overrun interrupt) while it is in process of doing proc_exit,it is possible for Async_NotifyHandler() to try to start a transactionwhen one is already running. This leads to Asserts() or worse. I thinkit may only be possible to occur when frontend synchronization is lost(ie, the elog(FATAL) in SocketBackend() fires), but that is a standardoccurrence after error during COPY. In any case, I have seen thisfailure occur during regression tests, so it is definitely possible.
1 parent5ea9322 commit53e95ee

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎src/backend/commands/async.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.90 2002/09/02 02:47:01 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.91 2002/09/16 01:24:41 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -593,6 +593,10 @@ Async_NotifyHandler(SIGNAL_ARGS)
593593
* ever turned on.
594594
*/
595595

596+
/* Don't joggle the elbow of proc_exit */
597+
if (proc_exit_inprogress)
598+
return;
599+
596600
if (notifyInterruptEnabled)
597601
{
598602
/*

‎src/backend/tcop/postgres.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.291 2002/09/04 20:31:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.292 2002/09/16 01:24:41 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1071,12 +1071,14 @@ ProcessInterrupts(void)
10711071
ProcDiePending= false;
10721072
QueryCancelPending= false;/* ProcDie trumps QueryCancel */
10731073
ImmediateInterruptOK= false;/* not idle anymore */
1074+
DisableNotifyInterrupt();
10741075
elog(FATAL,"This connection has been terminated by the administrator.");
10751076
}
10761077
if (QueryCancelPending)
10771078
{
10781079
QueryCancelPending= false;
10791080
ImmediateInterruptOK= false;/* not idle anymore */
1081+
DisableNotifyInterrupt();
10801082
elog(ERROR,"Query was cancelled.");
10811083
}
10821084
/* If we get here, do nothing (probably, QueryCancelPending was reset) */
@@ -1689,7 +1691,7 @@ PostgresMain(int argc, char *argv[], const char *username)
16891691
if (!IsUnderPostmaster)
16901692
{
16911693
puts("\nPOSTGRES backend interactive interface ");
1692-
puts("$Revision: 1.291 $ $Date: 2002/09/04 20:31:26 $\n");
1694+
puts("$Revision: 1.292 $ $Date: 2002/09/16 01:24:41 $\n");
16931695
}
16941696

16951697
/*
@@ -1736,6 +1738,7 @@ PostgresMain(int argc, char *argv[], const char *username)
17361738
QueryCancelPending= false;
17371739
InterruptHoldoffCount=1;
17381740
CritSectionCount=0;/* should be unnecessary, but... */
1741+
DisableNotifyInterrupt();
17391742
debug_query_string=NULL;
17401743

17411744
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp