I think we need a different solution. Something like replace

class MemcacheClient(Client):
...

in gluon/contrib/memcache/__init__.py with

def MemcacheClient(*a,**b):
      ### implement some kind of thread pool
      return __MemcacheClient(*a,**b)
class __MemcacheClient(Client):
...

what do you think? Any suggestion?


On Sep 11, 1:38 pm, zahariash <karra...@gmail.com> wrote:
> I've found similar leak...
>
> Using MemcacheClient like described 
> here:http://web2py.com/AlterEgo/default/show/69
>  from gluon.contrib.memcache import MemcacheClient
>  memcache_servers=['127.0.0.1:11211']
>  cache.mem=MemcacheClient(request,memcache_servers)
> is dangerous, because it opens one connection each request...
>
> Socket isn't closed on object destruction. Solution is to invoke
> cache.ram.disconnect_all(), but there is no place to do that...
>
> This code, works:
> global cm
> if not cm:
>     cm=MemcacheClient(...)
> ...
>
> It, doesn't close socket either, but open it only once per thread...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to