timers

Juan Pablo L. jpablolorenzetti at hotmail.com
Thu Apr 10 22:39:36 CEST 2014


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).
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. 
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.
thank you very much!!
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). 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140410/6ca711e8/attachment-0001.html>


More information about the Freeradius-Users mailing list