On Jul 20, 2011, at 1:50 AM, Arthur Kopatsy wrote:

> Hi,
> 
> My web application has a controller that spawns multiple threads using
> a thread pool. Each of them has its own session (I store it in thread
> local). Occasionally (1 out of 100 or more)  I get really strange
> errors that really look like corrupted queries.
> 
> My guess is that it may be due to my thread pooling and the fact that
> a session may be reused for multiple jobs.

Yes this is most likely basic sharing of a Session and/or related state between 
threads.  The stack trace specifically is the access of an unloaded or expired 
attribute on a persistent object - this consults the Session to refresh the 
object.    Accesses like these need to be kept local to a single thread.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to