postgres.git / summary / log / commit / refs
commit 811969b218ac2e8030dfbbb05873344967461618
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Wed Apr 11 20:39:49 2018 +0000
First released in: 11.0, 10.4
Allocate enough shared string memory for stats of auxiliary processes.
This fixes a bug whereby the st_appname, st_clienthostname, and
st_activity_raw fields for auxiliary processes point beyond the end of
their respective shared memory segments. As a result, the application_name
of a backend might show up as the client hostname of an auxiliary process.
Backpatch to v10, where this bug was introduced, when the auxiliary
processes were added to the array.
Author: Edmund Horner
Reviewed-by: Michael Paquier
Discussion: https://www.postgresql.org/message-id/CAMyN-kA7aOJzBmrYFdXcc7Z0NmW%2B5jBaf_m%3D_-77uRNyKC9r%3DA%40mail.gmail.com
src/backend/postmaster/pgstat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 2c224ab97d8..084573e77c0 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -2650,7 +2650,7 @@ CreateSharedBackendStatus(void)
}
/* Create or attach to the shared appname buffer */
- size = mul_size(NAMEDATALEN, MaxBackends);
+ size = mul_size(NAMEDATALEN, NumBackendStatSlots);
BackendAppnameBuffer = (char *)
ShmemInitStruct("Backend Application Name Buffer", size, &found);
@@ -2668,7 +2668,7 @@ CreateSharedBackendStatus(void)
}
/* Create or attach to the shared client hostname buffer */
- size = mul_size(NAMEDATALEN, MaxBackends);
+ size = mul_size(NAMEDATALEN, NumBackendStatSlots);
BackendClientHostnameBuffer = (char *)
ShmemInitStruct("Backend Client Host Name Buffer", size, &found);
[parent: a820b4c32946]