Hi All.

I'm building an app on Pyramid framework and would like to use the
web2py-DAL with it. Unfortunately either Sqlalchemy nor ZODB are
options for this project.

I have found that a single web2py-DAL object cannot be shared around
threads. So my root_factory returns a new DAL object for every single
request. But it allocates memory and this memory doesn't get free. So
after some docents requests there are some hundreds MB wasted memory.
So after each request the DAL object should be manually closed.

Where does a pyramid request thread end? Where is the right place to
delete the DAL object? Is there an other option, to make a single root
object be used only from one thread at the same time?


=================
The following happens, if the DAL object is accessed from different
threads:
If I try to call multiple views from one web page asynchronously,
errors like "Invalid cursor state", "Invalid cursor reference" or
"Attempt to reclose a closed cursor" are coming up from the
kinterbasbd driver where sqlite just breaks down without any error
messages and takes python with it. These view callables are doing
nothing but simple reads by SELECTing. This happens in the case that
pyramids root factory returns the same DAL object with each request.
It seems like threads form different requests are working with the
same cursor object, so the cursor gets closed while the other thread
assumes the cursor to be here.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to