On Jun 15, 2010, at 12:59 PM, Vinay Sajip wrote: > On Jun 15, 4:30 pm, Michael Bayer <[email protected]> wrote: >> err, no, your test is incorrect. You are maintaining a reference to the >> SessionTransaction in "tolist". > > Whoops, you're right. However, should I really have to do a > gc.collect() after the session.remove() calls? Without it, I still get > the AssertionError. With it, I don't - but doesn't a requirement to > call gc.collect() mean that there could be non-deterministic, > potentially long pauses during request handling, because of other > stuff needing to be garbage-collected which has no connection to the > SQLA stuff?
your original error is that you're seeing a SQLite connection shared between threads. If there are connection or session resources still present in the interpreter, but they are unreachable (i.e. would be collected on the next gc run), it is impossible for that unreachable connection object to find its way into another one of your requests. So no, calling gc.collect() is not necessary under normal circumstances, it is only needed here to for the purposes of the method of testing. > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
