<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span><br></span></div><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; ">Hi.</span><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span>We're using pgpool as connection pooler and after upgrading to 3.1.1 we noticed a memory leak that occurs when executing several queries during the same connection.</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span>You can take the following bash script as example (call it feed_psql.sh).</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span>(test_table is a table with three integer fields).</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><font face="'Courier New', courier, monaco, monospace, sans-serif">#!/bin/bash</font></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">i=0 ;</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">while [ true ]; </font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    do</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    echo 'insert into test_table values ('${i}', '${i}', '${i}');'</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    i=$((i+1));</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    echo 'insert into test_table values ('${i}', '${i}', '${i}');'</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    i=$((i+1));</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">    sleep 1</font></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><font face="'Courier New', courier, monaco, monospace, sans-serif">done</font></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); ">Execute it so that its standard output is sent to standard input of psql:</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div style="color: rgb(0, 0, 0); font-size: 12pt; "><div><font face="'Courier New', courier, monaco, monospace, sans-serif"><span style="background-color: rgb(255, 255, 255); "># sh  </span>feed_psql.sh |<span style="background-color: rgb(255, 255, 255); "> psql -U edi -h /var/run -p </span><span class="Object" id="OBJ_PREFIX_DWT3188" style="color: rgb(0, 0, 139); text-decoration: none; cursor: pointer; background-color: rgb(255, 255, 255); ">127001 </span><span style="background-color: rgb(255, 255, 255); ">testdb</span></font></div></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); ">As you can see, the script is sending two queries per second to a postgres db using the same pgpool connection.</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); ">Using top we monitored the memory usage of the pgpool child process and, as you can see below, after few iterations memory keeps growing...</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                 </font></div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">20442 root      20   0 12088 1140  904 S    0  0.1   0:00.01 pgpool     </font></div></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><span style="background-color: rgb(255, 255, 255); "><br></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; ">After few iterations the RES field (The non-swapped physical memory a task has used) and the VIRT one grow up:<span style="background-color: rgb(255, 255, 255); "></span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><br></div><div><div><div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND               </font></div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">20442 root      20   0 13040 2032  908 S    0  0.1   0:00.05 pgpool            </font><font face="Arial">                                                                                                                                                  </font></div><div style="font-family: Arial; "><br></div><div style="font-family: Arial; ">I attached also the pgpool.conf used.</div></div><div style="font-family: Arial; ">Pgpool is connected to a postgresql 8.2 server.</div><div style="font-family: Arial; "><br></div><div style="font-family: Arial; "></div></div></div><div style="font-family: Arial; "><span style="font-size: 12pt; ">Could you help us, please? </span></div><div style="font-family: Arial; "><br></div><div style="font-family: Arial; "><span style="font-size: 12pt; ">Denis</span></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; "><br></div></div></body></html>