On May 30, 2013, at 7:16 AM, Ladislav Lenart <lenart...@volny.cz> wrote:
> Hello. > > I occasionally see DetachedInstanceError in apache error log of my web app. > > According to > > http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html#expunging > > an object is detached when: > > 1. It is expunged. > 2. The session is closed. > > I use expunge() only in some of my unit tests, never in the production code. > Thus the first option is out. The error occurs on various places but I think > the > session *should* be still opened when it happens. Can an object become > detached > any other way? if you mark it as deleted and commit the session, or if it is pending in the session and the session is rolled back. > > Do you have any idea how can I diagnose this problem given that: > * It happens sparingly and in random places? > * I am unable to reproduce it at will? > > The web app is running cherrypy under apache. get some more diagnostics around that exception, and take a look at other aspects of the object's state: - does it have a primary key, or was it pending? - was it deleted ? - where is the code that is accessing this object, and is the owning session still in effect at that point, or if not why? -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.