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

Jim Fulton jim at zope.com
Tue Apr 12 13:29:52 EDT 2011


Log message for revision 121412:
  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.10/src/CHANGES.txt
  U   ZODB/branches/3.10/src/ZEO/ServerStub.py
  U   ZODB/branches/3.10/src/ZEO/tests/testZEO.py

-=-
Modified: ZODB/branches/3.10/src/CHANGES.txt
===================================================================
--- ZODB/branches/3.10/src/CHANGES.txt	2011-04-12 15:08:11 UTC (rev 121411)
+++ ZODB/branches/3.10/src/CHANGES.txt	2011-04-12 17:29:51 UTC (rev 121412)
@@ -13,6 +13,18 @@
 
   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.
+
+
 Performance enhancements
 ------------------------
 

Modified: ZODB/branches/3.10/src/ZEO/ServerStub.py
===================================================================
--- ZODB/branches/3.10/src/ZEO/ServerStub.py	2011-04-12 15:08:11 UTC (rev 121411)
+++ ZODB/branches/3.10/src/ZEO/ServerStub.py	2011-04-12 17:29:51 UTC (rev 121412)
@@ -252,7 +252,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.10/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/branches/3.10/src/ZEO/tests/testZEO.py	2011-04-12 15:08:11 UTC (rev 121411)
+++ ZODB/branches/3.10/src/ZEO/tests/testZEO.py	2011-04-12 17:29:51 UTC (rev 121412)
@@ -1500,6 +1500,44 @@
     >>> c.close()
     """
 
+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(port='./sock', 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
     del unix_domain_sockets



More information about the Zodb-checkins mailing list