Is it possible to close a connection used in one thread from another
thread? My program has a locking mechanism, so I can ensure threads
don't use their connection while it's closed, but whenever I try to
close one thread's connection from another thread, I get errors like:

 File "C:\Program
Files\Python24\lib\site-packages\ZODB\", line 252, in
 File "C:\Program
Files\Python24\Lib\site-packages\transaction\", line 169,
in unre
 File "C:\Program Files\Python24\Lib\site-packages\ZODB\",
line 236, in remove
 File "C:\Program Files\Python24\lib\", line 19, in __delitem__
   def __delitem__(self, key): del[key]
KeyError: 26403280

The reason why I'm doing this is because I'm trying to update the
classes of persistent objects loaded into memory. I'm able to load the
new classes just fine, but when I try to close the connection at
program termination, I get the error:

ConnectionStateError: Cannot close a connection joined to a transaction

The only way I'm able to avoid this strange error is if I close all
connections during the update, but since my update function runs in a
different thread, it can't close the connections. Is there a way
around this, or am I misunderstanding something?

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to