On Jun 14, 3:14 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Jun 14, 2010, at 9:56 AM, Vinay Sajip wrote:

> There's really no way to tell what's happening in your app without an example 
> that illustrates the issue, such that if unusual behavior were observed, one 
> could issue a pdb and step around to see the state of things as they 
> progress.   You can check the source code of Session.remove() yourself - it 
> issues a close() on the session which detaches all objects, and then the 
> whole thing is just thrown away.   Its all Python GC accomplishing the work 
> here, and after remove() nothing on the SQLA side is referencing that 
> Session.    Its not just SQLite that would have issues if Session.remove() 
> left connection resources lying around - the connection would still have open 
> transactional resources on it, which would cause locking issues with 
> databases such as Postgresql and MS-SQL.
>
> My advice would be, assuming you cannot isolate the issue inside a small test 
> case, to trap the application at the point at which it appears to be opening 
> a "mystery" SessionTransaction, dropping into pdb, and checking around why 
> there's more than one Session in memory, as well as checking what 
> gc.collect() accomplishes here.

That's fine, I'll keep on digging - I was just hoping for some
guidance on where to dig most productively. The difficulty with making
a small test case is that the memory footprint would be quite
different, and the problem could fail to manifest - but I completely
understand that from your point of view, it's hard to comment further
without the small test case.

About the "mystery" SessionTransaction, for example - having put a log
statement in SessionTransaction.__init__, I would expect every
SessionTransaction creation to be logged. I couldn't easily see how
that SessionTransaction was created, though perhaps some more digging
through the source would enlighten me.

Regards,

Vinay Sajip

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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