pgpool2.git / summary / log / commit / refs

commit    9bdc8b1abd248dfd18952e3d4b4881b5798f505d
Author:   Tatsuo Ishii <ishii@sraoss.co.jp>
Date:     Fri Jan 01 02:29:04 2021 +0000

    Fix bug child_max_connections is not respected if ERROR occurs.
    
    When frontend aborts, the counter for child_max_connections is rewound
    because ereport(ERROR) issues long jump. Fix is declaring the variable
    with volatile qualifier. This is a long standing bug, probably since
    child_max_connections was introduced.


src/protocol/child.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/protocol/child.c b/src/protocol/child.c index 20a387f59..777858733 100644 --- a/src/protocol/child.c +++ b/src/protocol/child.c @@ -150,7 +150,13 @@ do_child(int *fds) struct timeval timeout; static int connected = 0; /* non 0 if has been accepted connections from * frontend */ - int connections_count = 0; /* used if child_max_connections > 0 */ + + /* counter for child_max_connections. "volatile" declaration is necessary + * so that this is counted up even if long jump is issued due to + * ereport(ERROR). + */ + volatile int connections_count = 0; + char psbuf[NI_MAXHOST + 128]; ereport(DEBUG2, [parent: 5583a539474e]