<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'><span>Sorry... the attachment was missing in previous mail.</span><div><span><br><span name="x"></span>Denis<span name="x"></span><br></span><br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><b>Da: </b>"Denis Gasparin" &lt;denis.gasparin@edistar.com&gt;<br><b>A: </b>pgpool-general@pgpool.net<br><b>Inviato: </b>Venerd́, 13 gennaio 2012 19:11:58<br><b>Oggetto: </b>[pgpool-general: 152] Pgpool 3.1.1: possible memory leak<br><br><style>p { margin: 0; }</style><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 ];&nbsp;</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">&nbsp; &nbsp; 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">&nbsp; &nbsp; 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">&nbsp; &nbsp; 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">&nbsp; &nbsp; 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">&nbsp; &nbsp; 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">&nbsp; &nbsp; 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 &nbsp;</span>feed_psql.sh |<span style="background-color: rgb(255, 255, 255); ">&nbsp;psql -U edi -h /var/run -p&nbsp;</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&nbsp;</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">&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp;VIRT &nbsp;RES &nbsp;SHR S %CPU %MEM &nbsp; &nbsp;TIME+ &nbsp;COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">20442 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 12088 1140 &nbsp;904 S &nbsp; &nbsp;0 &nbsp;0.1 &nbsp; 0:00.01 pgpool &nbsp; &nbsp;&nbsp;</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">&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp;VIRT &nbsp;RES &nbsp;SHR S %CPU %MEM &nbsp; &nbsp;TIME+ &nbsp;COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div><font face="'Courier New', courier, monaco, monospace, sans-serif">20442 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 13040 2032 &nbsp;908 S &nbsp; &nbsp;0 &nbsp;0.1 &nbsp; 0:00.05 pgpool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font><font face="Arial"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</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?&nbsp;</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><br>_______________________________________________<br>pgpool-general mailing list<br>pgpool-general@pgpool.net<br>http://www.pgpool.net/mailman/listinfo/pgpool-general<br></blockquote><br></div></div></body></html>