[Zope] Zope and Threads

Johan Carlsson johanc@easypublisher.com
Wed, 09 Jul 2003 20:25:52 +0200


alan runyan wrote:
> Hi.
> 
> 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.
> 
> This is my interpretation of events.  I could be wrong.
> I have started smoking again since the beginning of this
> fiasco.
> 
> The situation:
> 
>  - need to run a thread that does lots of ZSQLMethod calls
>  and then generates a Report
> 
>  - we would launch a Report thread in Zope
> 
>  - but how it interacted with the database connection was
>  very strange.  Connections that were launched with the
>  thread would be reused and would get really bizarre problems.
>  like inserts not showing up, etc.

Just out of curiosity.
How did you handle commits in the Report thread?

Was this problems always related to using ZSQLMethod or
did the problem also appear when only the ZODB was used,
or have you not tried pure ZODB?


> 
>  so far it works beautifully!  I plan to post on zopelabs the threading
>  solution with a huge warning not to use it in conjunction with 
> ZSQLMethods.
>  but I think it should be (actively) discouraged spawning threads inside of
>  ZEO.

Does these problems only appear in ZEO or would they appear in a single 
mounted database Zope as well?

Johan

-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc@easypublisher.com
SE-113 37 STOCKHOLM