Commit 952c0d8f authored by Jim Fulton's avatar Jim Fulton

Added logic to fix race condition involving the commit lock when

the connection to the storage server is disconnected.
parent 0b8b4390
......@@ -84,7 +84,7 @@
##############################################################################
"""Network ZODB storage client
"""
__version__='$Revision: 1.13 $'[11:-2]
__version__='$Revision: 1.14 $'[11:-2]
import struct, time, os, socket, string, Sync, zrpc, ClientCache
import tempfile, Invalidator, ExtensionClass, thread
......@@ -105,6 +105,11 @@ class UnrecognizedResult(ClientStorageError):
"""A server call returned an unrecognized result
"""
class ClientDisconnected(ClientStorageError):
"""The database storage is disconnected from the storage.
"""
class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
_connected=_async=0
......@@ -184,11 +189,11 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
def notifyDisconnected(self, ignored):
LOG("ClientStorage", PROBLEM, "Disconnected from storage")
self._connected=0
self._transaction=None
thread.start_new_thread(self._call.connect,(0,))
try: self._commit_lock_release()
except: pass
def becomeAsync(self, map):
self._lock_acquire()
try:
......@@ -401,6 +406,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
self._lock_release()
self._commit_lock_acquire()
self._lock_acquire()
if not self._connected: raise ClientDisconnected()
try: r=self._call(self.__begin, id, user, desc, ext)
except:
self._commit_lock_release()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment