Question

The Problem: Whenever a user navigates to an error page, instead of displaying 'Page not found' message in plone, this zope error message is displayed instead:

NotFound('  <h2>Site Error</h2>\n  <p>An error was encountered while publishing this resource.\n  </p>\n  <p><strong>Resource not found</strong></p>\n\n  Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://www.caseware.com/ddddd</p>\n  <hr noshade="noshade"/>\n\n  <p>Troubleshooting Suggestions</p>\n\n  <ul>\n  <li>The URL may be incorrect.</li>\n  <li>The parameters passed to this resource may be incorrect.</li>\n  <li>A resource that this resource relies on may be\n      encountering an error.</li>\n  </ul>\n\n  <p>For more detailed information about the error, please\n  refer to the error log.\n  </p>\n\n  <p>If the error persists please contact the site maintainer.\n  Thank you for your patience.\n  </p>',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: )

At the same time, log file for the instance in which error occurs displays the following stack trace:

2012-10-03T13:12:06 ERROR root Exception while rendering an error message
Traceback (most recent call last):
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/OFS/SimpleItem.py", line 242, in raise_standardErrorMessage
    v = s(**kwargs)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPythonScript.py", line 130, in __call__
    return Script.__call__(self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
File "/home/alex/projects/production/plone4_dev/eggs/Products.PythonScripts-2.13.0-py2.6.egg/Products/PythonScripts/PythonScript.py", line 344, in _exec
    result = f(*args, **kw)
File "Script (Python)", line 34, in standard_error_message
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 240, in _exec
    result = self.pt_render(extra_context=bound_names)
File "/home/alex/projects/production/plone4_dev/eggs/Products.CMFCore-2.2.5-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 180, in pt_render
    self, source, extra_context
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/PageTemplate.py", line 79, in pt_render
    showtal=showtal)
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 888, in do_useMacro
    self.interpret(macro)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 218, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.contentprovider-3.7.2-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
File "/home/alex/projects/production/plone4_dev/eggs/plone.app.viewletmanager-2.0.2-py2.6.egg/plone/app/viewletmanager/manager.py", line 85, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
File "/home/alex/projects/production/plone4_dev/eggs/zope.browserpage-3.12.2-py2.6.egg/zope/browserpage/simpleviewclass.py", line 44, in __call__
    return self.index(*args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.im_func(im_self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 218, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.contentprovider-3.7.2-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
File "/home/alex/projects/production/plone4_dev/eggs/zope.viewlet-3.7.2-py2.6.egg/zope/viewlet/manager.py", line 124, in render
    return self.template(viewlets=self.viewlets)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.im_func(im_self, *args, **kw)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/home/alex/projects/production/plone4_dev/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 819, in do_loop_tal
    iterator = self.engine.setRepeat(name, expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 682, in setRepeat
    expr = self.evaluate(expr)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
File "/home/alex/projects/production/plone4_dev/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/expressions.py", line 217, in __call__
    return self._eval(econtext)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 155, in _eval
    return render(ob, econtext.vars)
File "/home/alex/projects/production/plone4_dev/eggs/Zope2-2.13.12-py2.6.egg/Products/PageTemplates/Expressions.py", line 117, in render
    ob = ob()
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/browser/scripts.py", line 27, in scripts
    content = registry.getInlineResource(script.getId(), context)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 856, in getInlineResource
    output = self.getResourceContent(item, context)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/JSRegistry.py", line 246, in getResourceContent
    output = BaseRegistryTool.getResourceContent(self, item, context, original)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 593, in getResourceContent
    self._restoreCachingHeaders(original_headers, if_modified)
File "/home/alex/projects/production/plone4_dev/eggs/Products.ResourceRegistries-2.0.6-py2.6.egg/Products/ResourceRegistries/tools/BaseRegistry.py", line 661, in _restoreCachingHeaders
    assert int(self.REQUEST.RESPONSE.getStatus()) / 100 == 2
AssertionError

I've been trying to figure this out for the last few days, but the main problem is -- this error occurs only in production configuration, and I can't reproduce it in development environment.

The problem has started when the site was upgraded with a new design using diazo, it also has been moved from Centos 5.6 to Centos 6, but I don't think it matters that much. Otherwise bulidout.cfg remained unchanged.

When I'm trying to reproduce the error on local development machine, I could only trigger it when instance is running with debug-mode = off, and the process has to be running in the background, whenever it runs in the foreground, error doesn't get triggered and correct 404 error message is displayed; basically everything runs fine in development environment, but as soon as code is moved in production, 404 page gets broken.

Environment info:

Plone 4.1.4
Zope 2.13.12
Python 2.6.7 (r267:88850, Dec 13 2011, 17:15:07) [GCC 4.6.2]
Was it helpful?

Solution

The assert line is a long-standing problem in Plone, one that I haven't followed all the intricacies on. There currently is one open bug involving the assert still:

I suspect that you have a JavaScript resource that is rendered inline, including in the error page. It seems the resource registry assert is not taking into account a inline response on a non-200 page (such a as a 404 Not Found response).

The above issue has a patch attached. If the patch works for you, I suggest you comment on the ticket and state it worked for you. Do confirm that you have an inline JavaScript resource in your resource registry though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top