Re: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
Chris Withers wrote at 2005-9-23 16:09 +0100: >Is there any reason these shouldn't be included in core Zope? Esthetic (probably spelled badly) reasons maybe: ZODB/ZEO is an independent package (not depending on Zope). The patches let it at least reference Zope. A cleaner solution would be to start ZEO in a Zope environment with a different Zope specific script which could activate the shown patches and then call "runzeo". > >> I modified "runzeo" to prevent it to start Zope. >> >> It looks like this: >> >> def main(args=None): >> try: >> # DM: prevent Zope from being start up >> # (out of conflict resolution code) >> import Zope; Zope.startup = None >> except ImportError: pass >> >> I also added the following patch: >> >> # DM: 2004-06-03 >> # activate Zope's INSTANCE_HOME magic. >> # This is necessary for conflict resolution of classes >> # defined in "$INSTANCE_HOME/Products" >> # Note that this is only a partial workaround. A complete solution >> # would give ZEO the same Python path and product configuration options >> # used by Zope. To get better control which classes are loaded >> # an additional registration facility for such classes would >> # be needed as well. >> try: from App import FindHomes >> except ImportError: pass # this is not Zope -- Dieter ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
Is there any reason these shouldn't be included in core Zope? Chris Dieter Maurer wrote: Paolo Linux wrote at 2005-9-21 11:23 +0200: ... I had zodb hanging when It had to solve Conflict situations. It turned out to be that it tried to import some modules that tried to instantiate ClientStorage... I easily fixed the hurting code... Lesson learned: - never automatically register in db objects via __init__ (or access to zodb, more generally) - instantiate ClientStorage only when required... Just a small suggestion. Is there any way to catch this problem and issue a specific Execption rather that letting zeo hanging? I modified "runzeo" to prevent it to start Zope. It looks like this: def main(args=None): try: # DM: prevent Zope from being start up # (out of conflict resolution code) import Zope; Zope.startup = None except ImportError: pass I also added the following patch: # DM: 2004-06-03 # activate Zope's INSTANCE_HOME magic. # This is necessary for conflict resolution of classes # defined in "$INSTANCE_HOME/Products" # Note that this is only a partial workaround. A complete solution # would give ZEO the same Python path and product configuration options # used by Zope. To get better control which classes are loaded # an additional registration facility for such classes would # be needed as well. try: from App import FindHomes except ImportError: pass # this is not Zope -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
Dieter Maurer wrote: Paolo Linux wrote at 2005-9-21 11:23 +0200: ... I had zodb hanging when It had to solve Conflict situations. It turned out to be that it tried to import some modules that tried to instantiate ClientStorage... cut... Just a small suggestion. Is there any way to catch this problem and issue a specific Execption rather that letting zeo hanging? I modified "runzeo" to prevent it to start Zope. cut... I also added the following patch: Thanks for inspiration ;-) Pao ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
Tim Peters wrote: I had zodb hanging when It had to solve Conflict situations. It turned out to be that it tried to import some modules that tried to instantiate ClientStorage... ... cut ... Just a small suggestion. Is there any way to catch this problem and issue a specific Execption rather that letting zeo hanging? I expect you'll discover the difficulties if you try to define _precisely_ what "this problem" is. How is the ZEO client connection code supposed to guess that, despite that you asked to connect to a ZEO server, you didn't really mean it ;-) ? Is there any use case for this scenario? clonflict resolution calling code that need to open another connection to the same db? In fact it was zeo server code looping using 100% CPU... probably there is the place where to check... Extreme answers like "well, it could examine the call stack and see whether conflict resolution invoked this code, and then guess that, if it is, the code didn't really mean to connect to ZEO" don't make much sense. If the problem statement is correct, available solutions can be analyzed... I don't see any reason for zeo server needing to open client connection to itself... But... this is seem an academic discussion and nothing that really deserves time... When you are inexperienced and come from 2 debugging days, it's difficult to be lucid enough to do smart posts ;-) Ciao!!! Pao ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
Paolo Linux wrote at 2005-9-21 11:23 +0200: > ... >I had zodb hanging when It had to solve Conflict situations. >It turned out to be that it tried to import some modules that >tried to instantiate ClientStorage... > >I easily fixed the hurting code... >Lesson learned: > >- never automatically register in db objects via __init__ > (or access to zodb, more generally) > >- instantiate ClientStorage only when required... > >Just a small suggestion. Is there any way to catch this problem >and issue a specific Execption rather that letting zeo hanging? I modified "runzeo" to prevent it to start Zope. It looks like this: def main(args=None): try: # DM: prevent Zope from being start up # (out of conflict resolution code) import Zope; Zope.startup = None except ImportError: pass I also added the following patch: # DM: 2004-06-03 # activate Zope's INSTANCE_HOME magic. # This is necessary for conflict resolution of classes # defined in "$INSTANCE_HOME/Products" # Note that this is only a partial workaround. A complete solution # would give ZEO the same Python path and product configuration options # used by Zope. To get better control which classes are loaded # an additional registration facility for such classes would # be needed as well. try: from App import FindHomes except ImportError: pass # this is not Zope -- Dieter ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
RE: [ZODB-Dev] Problems when Conflict Resolution import code that try to open client storage
[Paolo Linux] > as a zodb newbie I had a hard debugging session... > > I had zodb hanging when It had to solve Conflict situations. It turned > out to be that it tried to import some modules that tried to instantiate > ClientStorage... > > I easily fixed the hurting code... Lesson learned: > > - never automatically register in db objects via __init__ >(or access to zodb, more generally) > > - instantiate ClientStorage only when required... > > Just a small suggestion. Is there any way to catch this problem and > issue a specific Execption rather that letting zeo hanging? I expect you'll discover the difficulties if you try to define _precisely_ what "this problem" is. How is the ZEO client connection code supposed to guess that, despite that you asked to connect to a ZEO server, you didn't really mean it ;-) ? Extreme answers like "well, it could examine the call stack and see whether conflict resolution invoked this code, and then guess that, if it is, the code didn't really mean to connect to ZEO" don't make much sense. ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev