alan runyan wrote at 2003-7-9 13:06 -0500:
Just wanted to post this for whoever searches for Zope, Threads and ZSQLMethods or relational databases in the future. It seems that very simplistic things will work if you spawn a thread inside of Zope. But in the thread if you start doing anything really related to ZODB you could have all sorts of issues.
The mailing list archives have some threads about this... There are a few issues you must observe: In general you must not share a ZODB connection between threads. This means, you must not pass persistent objects between threads (as they contain a hidden reference to a ZODB connection (_p_jar) and may use it non-deterministically). Open a new ZODB connection in the new thread. Its "root()" method returns the ZODB root object. Pass an object's path between threads rather than the object itself. Use "[un]restrictedTraverse" to locate the object from the root given the path. Do not forget to commit/abort the (implicitly) started transaction. Do not forget to close the opened ZODB connection Dieter