[Zope-dev] Conflict errors on startup, revisited

Paul Winkler pw_lists at slinkp.com
Thu Feb 24 14:29:50 EST 2005


This is a topic that comes up occasionally, but since the symptom
seems to be rare and hard to provoke, it never gets resolved.
Well it's biting me again and I'm determined to fix it, but
would like some input from the list.

Related collector issues:
http://www.zope.org/Collectors/Zope/300
http://www.zope.org/Collectors/Zope/1201

The issue:
On rare occasions I have seen ConflictErrors raised during
product installation.

Today, I can finally provoke them at will with a pretty minimal setup.

The setup:
Zope 2.7.3, using ZEO, with DirectoryStorage on the ZEO server.
Hardware:  dual-processor PIII 800, some kinda scsi disk, ext3, 
some old redhat flavor of linux.

To provoke it I need merely do
./bin/zopectl run foo.py

... where foo.py is empty.
Products/ now contains only one dummy product,
which I've named Conflictor, which contains only an empty __init__.py.
I get a ConflictError during registration of Conflictor.

Interestingly I can only provoke this ConflictError in this particular
INSTANCE_HOME.  I have several other instances and am not seeing the
symptom there.

I started trivially hacking OFS/Application.py to add some debugging output
(a diff against 2.7.3 is attached), and here's what I get:


[pwinkler at dev-zope-knox01 PaulMiniInstanceHome]$ ls Products/
[pwinkler at dev-zope-knox01 PaulMiniInstanceHome]$ mkdir Products/Conflicter
[pwinkler at dev-zope-knox01 PaulMiniInstanceHome]$ touch Products/Conflicter/__in
it__.py
[pwinkler at dev-zope-knox01 PaulMiniInstanceHome]$ touch foo.py
[pwinkler at dev-zope-knox01 PaulMiniInstanceHome]$ ./bin/zopectl run foo.py
installing product PluginIndexes...OK!
installing product Conflicter... BZZT
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "/usr/local/lib/python2.3/site-packages/PIL/__init__.py", line 51, in app


  File "/usr/local/lib/python2.3/site-packages/PIL/__init__.py", line 47, in startup

  File "/zope/Zope-2.7.3-SoftwareHome/lib/python/Zope/App/startup.py", line 96,
in startup
  File "/zope/ZopeSoftwareHome/lib/python/OFS/Application.py", line 279, in init
ialize
    initializer.initialize()
  File "/zope/ZopeSoftwareHome/lib/python/OFS/Application.py", line 306, in init
ialize
    self.install_products()
  File "/zope/ZopeSoftwareHome/lib/python/OFS/Application.py", line 561, in inst
all_products
    return install_products(app)
  File "/zope/ZopeSoftwareHome/lib/python/OFS/Application.py", line 597, in inst
all_products
    folder_permissions, raise_exc=debug_mode)
  File "/zope/ZopeSoftwareHome/lib/python/OFS/Application.py", line 803, in inst
all_product
    get_transaction().commit()
  File "/zope/Zope-2.7.3-SoftwareHome/lib/python/ZODB/Transaction.py", line 252,
 in commit
  File "/zope/Zope-2.7.3-SoftwareHome/lib/python/ZODB/Connection.py", line 738,
in tpc_vote
  File "/zope/Zope-2.7.3-SoftwareHome/lib/python/ZEO/ClientStorage.py", line 841
, in tpc_vote
  File "/zope/Zope-2.7.3-SoftwareHome/lib/python/ZEO/ClientStorage.py", line 825
, in _check_serials
ZODB.POSException.ConflictError: database conflict error (serial this txn starte
d with 0x035b25f36751f988 2005-02-10 18:59:24.215675, serial currently committed
 0x035b743c6d186822 2005-02-24 17:00:25.569220)


I guess what I'm asking, before I hack more on OFS/Application.py,
is this:

* any ideas re. what on earth could be causing this ConflictError?
  the product doesn't DO anything fer chrissakes.
  (Maybe registration is finishing too fast??)

* Is the PIL stuff in the traceback a red herring or what?


-- 

Paul Winkler
http://www.slinkp.com
-------------- next part --------------
*** Application.py.ORIG	Thu Feb 24 14:27:23 2005
--- Application.py	Thu Feb 24 14:32:24 2005
***************
*** 34,39 ****
--- 34,40 ----
  from Acquisition import aq_base
  from App.Product import doInstall
  from App.config import getConfiguration
+ from ZODB.POSException import ConflictError
  
  class Application(Globals.ApplicationDefaultPermissions,
                    ZDOM.Root, Folder.Folder,
***************
*** 587,594 ****
          if done.has_key(product_name):
              continue
          done[product_name]=1
!         install_product(app, product_dir, product_name, meta_types,
!                         folder_permissions, raise_exc=debug_mode)
  
      Products.meta_types=Products.meta_types+tuple(meta_types)
      Globals.default__class_init__(Folder.Folder)
--- 588,606 ----
          if done.has_key(product_name):
              continue
          done[product_name]=1
!         # collector issue 300: handle ConflictErrors during installation
!         sys.stderr.write('installing product %s' % product_name)
!         try:
!             import time; time.sleep(0.1)
!             app._p_jar.sync()  # DM's suggestion
!             install_product(app, product_dir, product_name, meta_types,
!                             folder_permissions, raise_exc=debug_mode)
!             sys.stderr.write('...OK!\n')
!         except ConflictError:
!             # somehow we should retry it. XXX look at zpublisher
!             sys.stderr.write('... BZZT\n')
!             raise
! 
  
      Products.meta_types=Products.meta_types+tuple(meta_types)
      Globals.default__class_init__(Folder.Folder)


More information about the Zope-Dev mailing list