[Zope3-dev] thread.local & da-connection

Garanin Michael garanin at m-lan.ru
Mon Aug 29 16:45:56 EDT 2005


Hello!
I have situation: 
1) I have PostgreSQL database: max-connection == 5
2) I have one IZopeDatabaseAdapter
2) I create 10 threads and join's (!!!)  to main thread
2.1) In each thread i get IZopeConnection from IZopeDatabaseAdapter
2.2) execute simple select-statement & call transaction.commit

Result: sometimes (~ 1/10) i get exception "connection limit exceeded". 
I think: problem is safety stopped threads (and his locals) in memory
along short time => connections also in memory short time and not
destroed and not closed. Of course, i can call 'disconnect' every time,
but it's bad.

May be make connections-pool (only da with threadsafety==2) and after
transaction.commit\abort move connection to connections-pool for use in
other threads?

attach: 
1) thread_test.py
2) pgda.py - simple da for PostgreSQL for pyPgSql

Thanks!




  
 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgda.py
Type: text/x-python
Size: 2987 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20050830/863574d8/pgda.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thread_test.py
Type: text/x-python
Size: 859 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20050830/863574d8/thread_test.py


More information about the Zope3-dev mailing list