[pgpool-hackers: 4490] Issue with dynamic process management

Tatsuo Ishii ishii at postgresql.org
Fri Jul 19 15:44:34 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.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_pooled_connections.patch
Type: text/x-patch
Size: 1298 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20240719/c49baf19/attachment.bin>


More information about the pgpool-hackers mailing list