[Zope] Zope and Threads

alan runyan runyaga@runyaga.com
Thu, 10 Jul 2003 15:07:29 -0500


> 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.

did not do this (as I was selecting only from ZSQLMethods) - this
could have very well given us the odditiy of people adding data
and it appearing to show up and then not committing.

> Do not forget to close the opened ZODB connection

very good summary dieter.

thanks

~runyaga