Clear error_context_stack and debug_query_string at the beginning of proc_exit,

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 26ef5e9b2a6e3b91f0e42689d150c53491fcd4fc
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-03-20T00:58:46Z
Releases: 7.4.29
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 get
emitted while exiting.  Per report from Dennis Koegel, the context functions
won't necessarily work after we've started shutting down the backend, and it
seems possible that debug_query_string could be pointing at freed storage
as well.  The context information doesn't seem particularly relevant to
such messages anyway, so there's little lost by suppressing it.

Back-patch to all supported branches.  I can only demonstrate a crash with
log_disconnections messages back to 8.1, but the risk seems real in 8.0 and
before anyway.

Files

PathChange+/−
src/backend/storage/ipc/ipc.c modified +15 −1