Fix segfault when %a is in log_line_prefix and debug message is on.
authorTatsuo Ishii <ishii@postgresql.org>
Tue, 23 Jan 2018 23:01:22 +0000 (08:01 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Tue, 23 Jan 2018 23:01:22 +0000 (08:01 +0900)
commite6b4a1ec58ee3d0ca19957f19d643e9a867c26b9
tree80c60d5bd60d13b1c2ba0499b2dea31a56ee7146
parentb13f68e4443fce4a46bd523e401a2a9f6ecce27a
Fix segfault when %a is in log_line_prefix and debug message is on.

log_line_prefix() gets called to create a log line prefix string. If
"%a" is specified in "log_line_prefix" parameter, log_line_prefix()
calls MASTER_CONNECTION macro, which calls
pool_virtual_master_db_node_id(), which calls ereport(), which calls
log_line_prefix() if debug message is on. This leads to an infinite
recursion and a segfault. Fix is, calling MASTER_NODE_ID macro instead
of MASTER_CONNECTION macro.

Per bug 376.
src/utils/error/elog.c