[Zodb-checkins] SVN: ZODB/branches/3.9/src/ Bug Fixed

Jim Fulton jim at zope.com
Mon Apr 18 10:59:10 EDT 2011


Log message for revision 121441:
  Bug Fixed
  
  - "Blob temp file get's removed before it should",
    https://bugs.launchpad.net/zodb/+bug/595378
  
  A way this to happen is that a transaction is aborted after the
    commit process has started. I don't know how this would happen in
    the wild.
  
  In 3.10.3, the ZEO tpc_abort call to the server is changed to be
    synchronous, which should address this case. Maybe there's another
    case.
  

Changed:
  U   ZODB/branches/3.9/src/CHANGES.txt
  U   ZODB/branches/3.9/src/ZEO/ServerStub.py
  U   ZODB/branches/3.9/src/ZEO/tests/testZEO.py

-=-
Modified: ZODB/branches/3.9/src/CHANGES.txt
===================================================================
--- ZODB/branches/3.9/src/CHANGES.txt	2011-04-18 14:51:15 UTC (rev 121440)
+++ ZODB/branches/3.9/src/CHANGES.txt	2011-04-18 14:59:10 UTC (rev 121441)
@@ -13,7 +13,17 @@
 
   https://bugs.launchpad.net/zodb/+bug/737198
 
+- "Blob temp file get's removed before it should",
+  https://bugs.launchpad.net/zodb/+bug/595378
 
+  A way this to happen is that a transaction is aborted after the
+  commit process has started. I don't know how this would happen in
+  the wild.
+
+  In 3.10.3, the ZEO tpc_abort call to the server is changed to be
+  synchronous, which should address this case. Maybe there's another
+  case.
+
 3.9.7 (2010-09-28)
 ==================
 

Modified: ZODB/branches/3.9/src/ZEO/ServerStub.py
===================================================================
--- ZODB/branches/3.9/src/ZEO/ServerStub.py	2011-04-18 14:51:15 UTC (rev 121440)
+++ ZODB/branches/3.9/src/ZEO/ServerStub.py	2011-04-18 14:59:10 UTC (rev 121441)
@@ -249,7 +249,7 @@
         return self.rpc.call('tpc_finish', id)
 
     def tpc_abort(self, id):
-        self.rpc.callAsync('tpc_abort', id)
+        self.rpc.call('tpc_abort', id)
 
     def history(self, oid, length=None):
         if length is None:

Modified: ZODB/branches/3.9/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/branches/3.9/src/ZEO/tests/testZEO.py	2011-04-18 14:51:15 UTC (rev 121440)
+++ ZODB/branches/3.9/src/ZEO/tests/testZEO.py	2011-04-18 14:59:10 UTC (rev 121441)
@@ -1357,6 +1357,44 @@
     >>> _ = p.wait()
     """
 
+def gracefully_handle_abort_while_storing_many_blobs():
+    r"""
+
+    >>> import logging, sys
+    >>> old_level = logging.getLogger().getEffectiveLevel()
+    >>> logging.getLogger().setLevel(logging.ERROR)
+    >>> handler = logging.StreamHandler(sys.stdout)
+    >>> logging.getLogger().addHandler(handler)
+
+    >>> addr, _ = start_server(blob_dir='blobs')
+    >>> c = ZEO.connection(addr, blob_dir='cblobs')
+    >>> c.root.x = ZODB.blob.Blob('z'*(1<<20))
+    >>> c.root.y = ZODB.blob.Blob('z'*(1<<2))
+    >>> t = c.transaction_manager.get()
+    >>> c.tpc_begin(t)
+    >>> c.commit(t)
+
+We've called commit, but the blob sends are queued.  We'll call abort
+right away, which will delete the temporary blob files.  The queued
+iterators will try to open these files.
+
+    >>> c.tpc_abort(t)
+
+Now we'll try to use the connection, mainly to wait for everything to
+get processed. Before we fixed this by making tpc_finish a synchronous
+call to the server. we'd get some sort of error here.
+
+    >>> _ = c._storage._server.loadEx('\0'*8)
+
+    >>> c.close()
+
+    >>> logging.getLogger().removeHandler(handler)
+    >>> logging.getLogger().setLevel(old_level)
+
+
+
+    """
+
 if sys.platform.startswith('win'):
     del runzeo_logrotate_on_sigusr2
 



More information about the Zodb-checkins mailing list