[Zope-PTK] Broken Product - reload?

Jeffrey P Shell jeffrey@Digicool.com
Thu, 22 Mar 2001 16:49:24 -0500


On 3/22/01 4:23 PM, "Kent Polk" <kent@tiamat.goathill.org> wrote:

> Dieter Maurer wrote:
>> Kent Polk writes:
>>> Ok, I broke the CMFCore with a typo. I fixed the source file, but
>>> I can't figure out how to get Zope to reload the fixed version.
>>> CMFCore remains broken and Control_panel/Products/CMFCore complains
>>> about the error, which no longer exists. I've tried everything
>>> short of nuking the CMF instance I'm running, and I'd really rather
>>> not do that. :^(
>> Exceptions during a call to "initialize" are not shown
>> (except in the log file, if you enabled logging) and
>> cause the old information not to be updated.
>> 
>> You have two options:
>> 
>>  * delete the broken product and restart
>>    you will then see the (new) traceback
> 
> Turns out it wasn't getting this far.
> 
>>  * enable logging (STUPID_LOG_FILE=<your_log_file> on the command line),
>>    restart and look into the log file.
> 
> Well, I finally messed things up enough to convince it to issue an error
> message:
> 
> 2001-03-22T20:58:36 ERROR(200) Zope Couldn't install CMFCore
> Traceback (innermost last):
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/OFS/Applicatio
> n.py, line 627, in install_products
>   (Object: ApplicationDefaultPermissions)
>   (Info: CMFCore)
> File /var/zope/Products/CMFCore/__init__.py, line 168, in initialize
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/App/ProductCon
> text.py, line 365, in registerHelp
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/App/ProductCon
> text.py, line 298, in registerHelpTopic
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/OFS/ObjectMana
> ger.py, line 300, in _setObject
>   (Object: Traversable)
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/HelpSys/HelpTo
> pic.py, line 152, in manage_afterAdd
>   (Object: HelpTopicBase)
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/HelpSys/HelpTo
> pic.py, line 165, in index_object
>   (Object: HelpTopicBase)
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/Products/ZCata
> log/ZCatalog.py, line 424, in catalog_object
>   (Object: Traversable)
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/Products/ZCata
> log/Catalog.py, line 442, in catalogObject
> File 
> /export/home/zope/lib/Zope-2.3.1b2-solaris-2.6-sparc/lib/python/SearchIndex/Un
> TextIndex.py, line 335, in index_object
> SystemError: error return without exception set
> 
> Does this for about a dozen core products. I can't see why or what
> started it.  Files permissions are fine and all appears to be
> correct. Could something in the ZODB be triggering this?

Hmmm.  Waaa.

Sorry for not speaking up on this thing earlier.  I've seen this before...
Too much recently in fact.  Something bad is happening during initialize()
that is getting *completely* swallowed up.  There are a number of little
factors that can contribute.  I've found that the best way to find it (about
the only way in fact) is to use pdb.set_trace() and step through what's
going on in initialize until I notice the actual exception get raised.  If
you're not friends with the debugger, now's the time to become one!  (for
better or worse...)

What I've done is make the code look like this:

def initialize(context):
    import pdb; pdb.set_trace()

And start Zope up in debug mode.  After a few seconds, you'll be in the
debugger, in the 'set_trace' call.  Hit 's' once to step into the actual
'initialize' method, and then go from there until you see the real error.
Chances are there's a NameError or AttributeError occurring somewhere.

If you're an XEmacs user, Ken Manheimer's excellent PDBTrack utility is
wonderful when stepping into the nether-regions of initialization.

http://www.zope.org/Wikis/klm/PDBTrack

Jeffrey P Shell, jeffrey@Digicool.com
http://www.digicool.com/ | http://www.zope.org