Skip to content

Commit 811969b

Browse files
committed
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
1 parent a820b4c commit 811969b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,7 +2650,7 @@ CreateSharedBackendStatus(void)
26502650
}
26512651

26522652
/* Create or attach to the shared appname buffer */
2653-
size = mul_size(NAMEDATALEN, MaxBackends);
2653+
size = mul_size(NAMEDATALEN, NumBackendStatSlots);
26542654
BackendAppnameBuffer = (char *)
26552655
ShmemInitStruct("Backend Application Name Buffer", size, &found);
26562656

@@ -2668,7 +2668,7 @@ CreateSharedBackendStatus(void)
26682668
}
26692669

26702670
/* Create or attach to the shared client hostname buffer */
2671-
size = mul_size(NAMEDATALEN, MaxBackends);
2671+
size = mul_size(NAMEDATALEN, NumBackendStatSlots);
26722672
BackendClientHostnameBuffer = (char *)
26732673
ShmemInitStruct("Backend Client Host Name Buffer", size, &found);
26742674

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy