[Sqlalchemy-tickets] [sqlalchemy] #1013: Object is already attached error occuring intermittently
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2008-04-18 16:13:39
|
#1013: Object is already attached error occuring intermittently --------------------+------------------------------------------------------- Reporter: guest | Owner: zzzeek Type: defect | Status: new Priority: medium | Milestone: Component: (none) | Severity: no triage selected yet Keywords: | Status_field: awaiting triage --------------------+------------------------------------------------------- Apologies for a slightly sketchy bug report, if it is that. This issue occurs intermittently and I'm having trouble isolating a simple example which reproduces it. The issue is that the Error thrown at orm/session.py line 1102, in _attach is occuring at times, and I can't explain why. If I simply modify the lines {{{ if old_id is not None and old_id in _sessions and instance in _sessions[old_id]: raise exceptions.InvalidRequestError("Object '%s' is already attached " "to session '%s' (this is '%s')" % (mapperutil.instance_str(instance), old_id, id(self))) }}} to {{{ if old_id is not None and old_id in _sessions and instance in _sessions[old_id]: return }}} Then everything works fine for me. The error seems to be telling me that I've created two sessions and my instance is attached to the other session. I'm not aware of creating more than one session anywhere in the code - I'm working inside Turbogears. Perhaps if you could explain a little more what situation this is checking for then I can get to the bottom of it. Is it normal for there to be more than one session going on unless you explicitly create it? -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1013> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |