Hi All,

I'm building an app on Pyramid framework and would like to use the
web2py-DAL with it. Pyramid makes every request in a single thread, so
how should I manage the DAL object?

Should it be created once and then passed to every thread? If I do so
and some frequent queries are passed to the DAL (simple reads by
SELECT), I  get errors like "invalid cursor state", "cannot close a
closed cursor" and so on. That is because a single cursor is accessed
form different threads, so one thread closes the cursor while the
other assumes it to be open.

Should the DAL object be created on each request(like root =
DAL("sqlite://blah"))? If I do so, the cursor state errors go, but a
memory problem appears. Each request allocates memory for a new DAL
object and that memory is never released. After some dozens requests
I've got some hundredths MB of wasted memory.

How is the thread per request - DAL access managed by the web2py?

Thanks!

Reply via email to