I don't know if any of this will help - I'm too tired to read though all 
your code:

1. Twisted isn't threadsafe, so anything happening in deferToThread needs 
to be entirely encapsulated.  This has totally screwed me up many times. 
 You should avoid a scoped_session , as it has to do with threads.

2. You can't expect anything in twisted to be reused. 

The safest way i've found, and I've only experimented on migrating my 
twisted work to sqlalchemy :

1. Use a regular session for each request and explicitly pass it around. 
never use scoped_session.
2. Avoid threaded stuff as much as possible. For a while I had a 
`deferToThread` that wrapped a `runInteraction` . That ended up causing a 
memory leak ( threads spawning threads ).  

someone on this list was one trying to get scoped_session to work with 
twisted, and there was a lot of code that he wrote to do it.  there was 
never an official update.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to