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

Commitf784f05

Browse files
committed
Clear error_context_stack and debug_query_string at the beginning of proc_exit,
so that we won't try to attach any context printouts to messages that getemitted while exiting. Per report from Dennis Koegel, the context functionswon't necessarily work after we've started shutting down the backend, and itseems possible that debug_query_string could be pointing at freed storageas well. The context information doesn't seem particularly relevant tosuch messages anyway, so there's little lost by suppressing it.Back-patch to all supported branches. I can only demonstrate a crash withlog_disconnections messages back to 8.1, but the risk seems real in 8.0 andbefore anyway.
1 parentacdd6ea commitf784f05

File tree

1 file changed

+15
-1
lines changed
  • src/backend/storage/ipc

1 file changed

+15
-1
lines changed

‎src/backend/storage/ipc/ipc.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.106 2010/01/02 16:57:51 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.107 2010/03/20 00:58:09 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -28,6 +28,7 @@
2828
#include"postmaster/autovacuum.h"
2929
#endif
3030
#include"storage/ipc.h"
31+
#include"tcop/tcopprot.h"
3132

3233

3334
/*
@@ -163,6 +164,19 @@ proc_exit_prepare(int code)
163164
InterruptHoldoffCount=1;
164165
CritSectionCount=0;
165166

167+
/*
168+
* Also clear the error context stack, to prevent error callbacks
169+
* from being invoked by any elog/ereport calls made during proc_exit.
170+
* Whatever context they might want to offer is probably not relevant,
171+
* and in any case they are likely to fail outright after we've done
172+
* things like aborting any open transaction. (In normal exit scenarios
173+
* the context stack should be empty anyway, but it might not be in the
174+
* case of elog(FATAL) for example.)
175+
*/
176+
error_context_stack=NULL;
177+
/* For the same reason, reset debug_query_string before it's clobbered */
178+
debug_query_string=NULL;
179+
166180
/* do our shared memory exits first */
167181
shmem_exit(code);
168182

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp