<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><span style="color: rgb(68, 68, 68); font-size: 15px; line-height: 21px; background-color: rgb(255, 255, 255);">Hello everybody, i have developed a module for a prepaid data service on a CDMA network, the module is 100% functional at this point but i have a little big problem. i have, as part of the module, a postgres connection pool, that takes care of all the databases queries/accesses as well as the management of the pool, but during tests i have noticed that when these connections (or some of the connections) are not used for a long period of time (some hours) because of low traffic (e.g between 2 - 4 am) the connections becomes idle and even though they are not disconnected it gives an I/O error when you try to send anything to the database (even though the underlying  socket is created with the keepalive flag).</span><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">Having said that, i have added timers to these connections that monitor the time of inactivity that they have and once the threshold is reached the module disconnects them, so when a next time a connection is requested the pool just check if connected or not, if not connected if connects it and gives it to the caller, very simple really. </div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">The problem is, that all the nice timers work in an epoll in a thread inside the module. After researching the lists i have found out that that is not possible to do (to run a thread inside a module) ... so i would like to ask if there is any functionality in freeradius i m not aware of that could help me with this issue ? or if any of you faced the same situation, how you fixed that ? ... even though i have read that according to the freeradius developer that is a bad design, i really do not know of any other way how to deal with this situation, so i would really appreciate any feedback on this.</div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">thank you very much!!</div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">P.S: i do not want to start an argument whether is or it isnt a bad/good design, i think that was established already in the past, but as i said, i do not know how to deal with the idle connections problem in an efficient manner (i dont want to open/close connections every time i get a radius package but i also do not want to keep connections open using database/network/server resources when they are not needed).</div>                                        </div></body>
</html>