[pgpool-hackers: 4491] Re: Issue with dynamic process management

Tatsuo Ishii ishii at postgresql.org
Fri Jul 19 22:05:20 JST 2024


> I found an issue with dynamic process management. It looks for child
> process which has minimum number of pooled connections as a victim
> when pgpool wants to kill child process if there's excessive number of
> child process. The decision is based on a member called
> "pooled_connection" in process info structure
> (ProcessInfo). pooled_connection is calculated in
> update_pooled_connection_count().
> ------------------------------------------------------------
> 	int count = 0;
> 	POOL_CONNECTION_POOL *p = pool_connection_pool;
> 	for (i = 0; i < pool_config->max_pool; i++)
> 	{
> 		if (MAIN_CONNECTION(p))
> 			count++;
> 	}
> 	pool_get_my_process_info()->pooled_connections = count;
> ------------------------------------------------------------
> When "count" is accumlated, "p" is not updated and it continues to
> point to the same connection pool member. Thus above code always set
> the same values as max_pool regardless the number of pooled
> connections in the connection pool. I think:
> 
> 	for (i = 0; i < pool_config->max_pool; i++)
> 
> should be:
> 
> 	for (i = 0; i < pool_config->max_pool; i++, p++)
> 
> patch attached.

Fix pushed.

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=c2ceed29098369b3b52f02affe5a0123bdc0758e

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list