Repository: plone/Products.CMFPlone

Issue:
A simple PT can kill the Zope/WSGI server
Plone 5.2a1, Python 3.6.5.

By accident I had a condition `tal:condition="view"` in one of my templates.

This causes the complete Plone instance to shut down and exit (instead of raising a RecursionError exception).

Haven't verified if this is an issue with Zope 4 and/or Python 2.7 vs. 3.x.

```
2018-12-14 11:31:41,825 INFO  [Zope:44][MainThread] Ready to handle requests
Starting server in PID 14831.
Serving on http://0.0.0.0:8080
2018-12-14 11:32:24,117 DEBUG [plone.app.theming.policy:149][waitress] local cache invalidated on thread 140065861908224
2018-12-14 11:32:24,117 DEBUG [plone.app.theming.policy:112][waitress] initializing local cache on thread 140065861908224 for http://dev.zopyx.de:8080/Plone2::barceloneta
2018-12-14 11:32:35,100 ERROR [plone.app.viewletmanager:118][waitress] Error while rendering viewlet-manager=plone.toolbar, viewlet=plone.contentviews
Traceback (most recent call last):
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109, in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105, in __call__
    return base()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27, in menu
    items = menu.getMenuItems(self.context, self.request)
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52, in getMenuItems
    if item.available():
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53, in memogetter
    val = func(*args, **kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82, in available
    object=self.context, categories=('object_buttons',), max=1)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60, in listActionInfos
    ec = self._getExprContext(object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163, in _getExprContext
    return getExprContext(self, object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114, in getExprContext
    initializeTFC()
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30, in initializeTFC
    pkg_resources.get_distribution('Products.ATContentTypes')
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 474, in get_distribution
    dist = Requirement.parse(dist)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3009, in parse
    req, = parse_requirements(s)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956, in parse_requirements
    yield Requirement(line)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1400, in _parseNoCache
    if self.mayIndexError or preloc >= len(instring):
RecursionError: maximum recursion depth exceeded while calling a Python object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 110, in render
    html.append(viewlet.render())
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/common.py", line 64, in render
    return self.index()
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.__func__(__self__, *args, **kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85, in __call__
    return self.template.render(**kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158, in render
    return base_renderer(**context)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297, in render
    return super(PageTemplate, self).render(**_kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "36b67e998dfbfbee24dede2c2e225957.py", line 146, in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72, in render_content_provider
    return cp.render()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 18, in render
    return self.index()
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.__func__(__self__, *args, **kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85, in __call__
    return self.template.render(**kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158, in render
    return base_renderer(**context)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297, in render
    return super(PageTemplate, self).render(**_kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 203, in render
    raise_with_traceback(exc, tb)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/utils.py", line 75, in raise_with_traceback
    raise exc
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109, in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105, in __call__
    return base()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27, in menu
    items = menu.getMenuItems(self.context, self.request)
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52, in getMenuItems
    if item.available():
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53, in memogetter
    val = func(*args, **kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82, in available
    object=self.context, categories=('object_buttons',), max=1)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60, in listActionInfos
    ec = self._getExprContext(object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163, in _getExprContext
    return getExprContext(self, object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114, in getExprContext
    initializeTFC()
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30, in initializeTFC
    pkg_resources.get_distribution('Products.ATContentTypes')
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 474, in get_distribution
    dist = Requirement.parse(dist)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3009, in parse
    req, = parse_requirements(s)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956, in parse_requirements
    yield Requirement(line)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1400, in _parseNoCache
    if self.mayIndexError or preloc >= len(instring):
RecursionError: maximum recursion depth exceeded while calling a Python object

 - Expression: "view/menu"
 - Filename:   ... enu-2.2.4-py3.7.egg/plone/app/contentmenu/contentmenu.pt
 - Location:   (line 3: col 17)
 - Source:     define="menu view/menu;"
                            ^^^^^^^^^
 - Expression: "provider:plone.contentmenu"
 - Filename:   ... .0.0-py3.7.egg/plone/app/layout/viewlets/contentviews.pt
 - Location:   (line 9: col 32)
 - Source:     ... :replace="structure provider:plone.contentmenu" />
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  template: <ViewPageTemplateFile - at 0x7f63a47e1b70>
               options: {...} (0)
               args: <tuple - at 0x7f63ba31f048>
               nothing: <NoneType - at 0x8b1640>
               modules: <_SecureModuleImporter - at 0x7f63a94b61d0>
               request: <WSGIRequest - at 0x7f639ff34e80>
               view: <ContentMenuProvider plone.contentmenu at 0x7f63a34f8860>
               context: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               views: <ViewMapper - at 0x7f63a41ff208>
               here: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               container: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               root: <ImplicitAcquisitionWrapper  at 0x7f63a4ee4510>
               traverse_subpath: <list - at 0x7f63a4286c88>
               user: <ImplicitAcquisitionWrapper - at 0x7f63a4e5aee8>
               default: <object - at 0x7f63ba2fab10>
               repeat: {...} (0)
               loop: {...} (0)
               wrapped_repeat: <SafeMapping - at 0x7f63a03c7d88>
               target_language: <NoneType - at 0x8b1640>
               translate: <function translate at 0x7f63a43bb620>
Fatal Python error: Cannot recover from stack overflow.

Thread 0x00007f639e718700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0x00007f639ef19700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0x00007f639f71a700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Current thread 0x00007f639ff1b700 (most recent call first):
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 2816 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1443 in tryParse
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3471 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 4005 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644 in parseString
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90 in __init__
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963 in __init__
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956 in parse_requirements
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 737 in resolve
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 895 in require
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 352 in get_provider
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 476 in get_distribution
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30 in initializeTFC
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114 in getExprContext
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163 in _getExprContext
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60 in listActionInfos
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82 in available
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53 in memogetter
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52 in getMenuItems
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27 in menu
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 18 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72 in render_content_provider
  File "36b67e998dfbfbee24dede2c2e225957.py", line 146 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/common.py", line 64 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 110 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 198 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/toolbar.py", line 18 in base_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "09e7cf9d9b2b5f019c7f5f463522b608.py", line 267 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/toolbar.py", line 21 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72 in render_content_provider
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 505 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/xmldirector/connector/browser/connector.py", line 115 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 823 in __fill_main
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 1308 in render_content
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 683 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/xmldirector/connector/browser/connector.py", line 115 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 823 in __fill_main
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 1308 in render_content
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 683 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  ...

Thread 0x00007f63ba35ffc0 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/asyncore.py", line 144 in poll
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/asyncore.py", line 203 in loop
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/server.py", line 261 in run
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/__init__.py", line 17 in serve
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/__init__.py", line 20 in serve_paste
  File "/home/ajung/src/xmldirector.connector/eggs/PasteDeploy-1.5.2-py3.7.egg/paste/deploy/util.py", line 55 in fix_call
  File "/home/ajung/src/xmldirector.connector/eggs/PasteDeploy-1.5.2-py3.7.egg/paste/deploy/loadwsgi.py", line 189 in server_wrapper
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 194 in serve
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 204 in run
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 216 in main
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 219 in <module>
  File "/home/ajung/src/xmldirector.connector/parts/wsgi.py/bin/interpreter", line 272 in <module>
```
A simple PT can kill the Zope/WSGI server
Plone 5.2a1, Python 3.6.5.

By accident I had a condition `tal:condition="view"` in one of my templates.

This causes the complete Plone instance to shut down and exit (instead of raising a RecursionError exception).

Haven't verified if this is an issue with Zope 4 and/or Python 2.7 vs. 3.x.

```
2018-12-14 11:31:41,825 INFO  [Zope:44][MainThread] Ready to handle requests
Starting server in PID 14831.
Serving on http://0.0.0.0:8080
2018-12-14 11:32:24,117 DEBUG [plone.app.theming.policy:149][waitress] local cache invalidated on thread 140065861908224
2018-12-14 11:32:24,117 DEBUG [plone.app.theming.policy:112][waitress] initializing local cache on thread 140065861908224 for http://dev.zopyx.de:8080/Plone2::barceloneta
2018-12-14 11:32:35,100 ERROR [plone.app.viewletmanager:118][waitress] Error while rendering viewlet-manager=plone.toolbar, viewlet=plone.contentviews
Traceback (most recent call last):
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109, in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105, in __call__
    return base()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27, in menu
    items = menu.getMenuItems(self.context, self.request)
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52, in getMenuItems
    if item.available():
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53, in memogetter
    val = func(*args, **kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82, in available
    object=self.context, categories=('object_buttons',), max=1)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60, in listActionInfos
    ec = self._getExprContext(object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163, in _getExprContext
    return getExprContext(self, object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114, in getExprContext
    initializeTFC()
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30, in initializeTFC
    pkg_resources.get_distribution('Products.ATContentTypes')
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 474, in get_distribution
    dist = Requirement.parse(dist)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3009, in parse
    req, = parse_requirements(s)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956, in parse_requirements
    yield Requirement(line)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1400, in _parseNoCache
    if self.mayIndexError or preloc >= len(instring):
RecursionError: maximum recursion depth exceeded while calling a Python object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 110, in render
    html.append(viewlet.render())
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/common.py", line 64, in render
    return self.index()
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.__func__(__self__, *args, **kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85, in __call__
    return self.template.render(**kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158, in render
    return base_renderer(**context)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297, in render
    return super(PageTemplate, self).render(**_kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "36b67e998dfbfbee24dede2c2e225957.py", line 146, in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72, in render_content_provider
    return cp.render()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 18, in render
    return self.index()
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.__func__(__self__, *args, **kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85, in __call__
    return self.template.render(**kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158, in render
    return base_renderer(**context)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297, in render
    return super(PageTemplate, self).render(**_kw)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 203, in render
    raise_with_traceback(exc, tb)
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/utils.py", line 75, in raise_with_traceback
    raise exc
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183, in render
    self._render(stream, econtext, rcontext)
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109, in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105, in __call__
    return base()
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27, in menu
    items = menu.getMenuItems(self.context, self.request)
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52, in getMenuItems
    if item.available():
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53, in memogetter
    val = func(*args, **kwargs)
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82, in available
    object=self.context, categories=('object_buttons',), max=1)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60, in listActionInfos
    ec = self._getExprContext(object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163, in _getExprContext
    return getExprContext(self, object)
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114, in getExprContext
    initializeTFC()
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30, in initializeTFC
    pkg_resources.get_distribution('Products.ATContentTypes')
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 474, in get_distribution
    dist = Requirement.parse(dist)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3009, in parse
    req, = parse_requirements(s)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956, in parse_requirements
    yield Requirement(line)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3941, in parseImpl
    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3870, in parseImpl
    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1400, in _parseNoCache
    if self.mayIndexError or preloc >= len(instring):
RecursionError: maximum recursion depth exceeded while calling a Python object

 - Expression: "view/menu"
 - Filename:   ... enu-2.2.4-py3.7.egg/plone/app/contentmenu/contentmenu.pt
 - Location:   (line 3: col 17)
 - Source:     define="menu view/menu;"
                            ^^^^^^^^^
 - Expression: "provider:plone.contentmenu"
 - Filename:   ... .0.0-py3.7.egg/plone/app/layout/viewlets/contentviews.pt
 - Location:   (line 9: col 32)
 - Source:     ... :replace="structure provider:plone.contentmenu" />
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  template: <ViewPageTemplateFile - at 0x7f63a47e1b70>
               options: {...} (0)
               args: <tuple - at 0x7f63ba31f048>
               nothing: <NoneType - at 0x8b1640>
               modules: <_SecureModuleImporter - at 0x7f63a94b61d0>
               request: <WSGIRequest - at 0x7f639ff34e80>
               view: <ContentMenuProvider plone.contentmenu at 0x7f63a34f8860>
               context: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               views: <ViewMapper - at 0x7f63a41ff208>
               here: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               container: <ImplicitAcquisitionWrapper xxxxx at 0x7f63a4786798>
               root: <ImplicitAcquisitionWrapper  at 0x7f63a4ee4510>
               traverse_subpath: <list - at 0x7f63a4286c88>
               user: <ImplicitAcquisitionWrapper - at 0x7f63a4e5aee8>
               default: <object - at 0x7f63ba2fab10>
               repeat: {...} (0)
               loop: {...} (0)
               wrapped_repeat: <SafeMapping - at 0x7f63a03c7d88>
               target_language: <NoneType - at 0x8b1640>
               translate: <function translate at 0x7f63a43bb620>
Fatal Python error: Cannot recover from stack overflow.

Thread 0x00007f639e718700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0x00007f639ef19700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0x00007f639f71a700 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 296 in wait
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/queue.py", line 170 in get
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/task.py", line 73 in handler_thread
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 865 in run
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/threading.py", line 885 in _bootstrap

Current thread 0x00007f639ff1b700 (most recent call first):
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 2816 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1443 in tryParse
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3471 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 4005 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3552 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417 in parseImpl
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402 in _parseNoCache
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644 in parseString
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90 in __init__
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2963 in __init__
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2956 in parse_requirements
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 737 in resolve
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 895 in require
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 352 in get_provider
  File "/home/ajung/src/xmldirector.connector/lib/python3.7/site-packages/pkg_resources/__init__.py", line 476 in get_distribution
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 30 in initializeTFC
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 114 in getExprContext
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/PloneBaseTool.py", line 163 in _getExprContext
  File "/home/ajung/src/xmldirector.connector/eggs/Products.CMFPlone-5.2a1-py3.7.egg/Products/CMFPlone/ActionsTool.py", line 60 in listActionInfos
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/menu.py", line 82 in available
  File "/home/ajung/src/xmldirector.connector/eggs/plone.memoize-1.2.3-py3.7.egg/plone/memoize/instance.py", line 53 in memogetter
  File "/home/ajung/src/xmldirector.connector/eggs/zope.browsermenu-4.4-py3.7.egg/zope/browsermenu/menu.py", line 52 in getMenuItems
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 27 in menu
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "6c8ffcea73d20e781fc49bce59d6f5e4.py", line 109 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.contentmenu-2.2.4-py3.7.egg/plone/app/contentmenu/view.py", line 18 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72 in render_content_provider
  File "36b67e998dfbfbee24dede2c2e225957.py", line 146 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/common.py", line 64 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 110 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.viewletmanager-3.0.0-py3.7.egg/plone/app/viewletmanager/manager.py", line 198 in render
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/toolbar.py", line 18 in base_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "09e7cf9d9b2b5f019c7f5f463522b608.py", line 267 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/plone.app.layout-3.0.0-py3.7.egg/plone/app/layout/viewlets/toolbar.py", line 21 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/expressions.py", line 72 in render_content_provider
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 505 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/xmldirector/connector/browser/connector.py", line 115 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 823 in __fill_main
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 1308 in render_content
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 683 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/zpt/template.py", line 297 in render
  File "/home/ajung/src/xmldirector.connector/eggs/z3c.pt-3.1.0-py3.7.egg/z3c/pt/pagetemplate.py", line 158 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/engine.py", line 85 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/zope.pagetemplate-4.4.1-py3.7.egg/zope/pagetemplate/pagetemplate.py", line 135 in pt_render
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 60 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/Five/browser/pagetemplatefile.py", line 125 in __call__
  File "/home/ajung/src/xmldirector.connector/xmldirector/connector/browser/connector.py", line 115 in __call__
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Products/PageTemplates/expression.py", line 105 in __call__
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 823 in __fill_main
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 1308 in render_content
  File "efeb109b2ca51a96fb0b8f1f7752fa72.py", line 683 in render_master
  File "e11e5d5edb7fe5d5fd96e1f0538b2101.py", line 1452 in render
  File "/home/ajung/src/xmldirector.connector/eggs/Chameleon-3.4-py3.7.egg/chameleon/template.py", line 183 in render
  ...

Thread 0x00007f63ba35ffc0 (most recent call first):
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/asyncore.py", line 144 in poll
  File "/home/ajung/.pyenv/versions/3.7.1/lib/python3.7/asyncore.py", line 203 in loop
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/server.py", line 261 in run
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/__init__.py", line 17 in serve
  File "/home/ajung/src/xmldirector.connector/eggs/waitress-1.1.0-py3.7.egg/waitress/__init__.py", line 20 in serve_paste
  File "/home/ajung/src/xmldirector.connector/eggs/PasteDeploy-1.5.2-py3.7.egg/paste/deploy/util.py", line 55 in fix_call
  File "/home/ajung/src/xmldirector.connector/eggs/PasteDeploy-1.5.2-py3.7.egg/paste/deploy/loadwsgi.py", line 189 in server_wrapper
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 194 in serve
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 204 in run
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 216 in main
  File "/home/ajung/src/xmldirector.connector/eggs/Zope-4.0b7-py3.7.egg/Zope2/Startup/serve.py", line 219 in <module>
  File "/home/ajung/src/xmldirector.connector/parts/wsgi.py/bin/interpreter", line 272 in <module>
```


Discussion:
Calling the view from the same view will naturally result in a infinite recursion in any version of Plone with any version of Python. How is this a bug?
Sorry, I see. The infinite recursion is expected, the instance dying is not.
Yes, possibly somehow an attack vector e.g. by ttw customizations (Rapido or so)...
I am looking in to this. 
I think this is a chameleon issue.
@malthe @MatthewWilkes do you have some suggestions?
I think this is something related to https://github.com/malthe/chameleon/commit/913abdede94fbb716c6cd2ed6519e99c3521547c
Note that if I lower the recursion limit to 999 (with `sys.setrecursionlimit(999)`) everything works fine.
The default for the recursion limit is 1000.
"Overflowing while handling an overflow. Give up."

I think the exception handling logic should check if an error is a recursion error and in that case not attempt to do any fancy stuff.

It would be great with a test in Chameleon proper showing this behavior.
Wow, I don't recognise much of my thinking from that old PR. I obviously didn't keep thr chameleon magic in my brain.

I think special casing recursion makes sense, but will that make it hard to find the cause of the exception because of less informative exceptions?

Also, I think as this is now a released version we probably need to do security response. I'll ping the team.
No success reproducing but I didn't use a lot of effort either:

https://github.com/malthe/chameleon/compare/add-recursion-limit-error-test?expand=1
@malthe I also tried something similar:
```
    def test_render_pt_with_infinite_recursion(self):
        template = self.from_string(
            '''
            <tal:defs define="foo python:view(view=view)" />
            ''')
        result = template(view=template)
```
and had a proper traceback.
It seems that the stack overflow is triggered when you have something more complex and it has nothing to do with the exception handling, i.e. with this patch:
```diff
diff --git a/src/chameleon/template.py b/src/chameleon/template.py
index d6c63d9..b47ec27 100644
--- a/src/chameleon/template.py
+++ b/src/chameleon/template.py
@@ -179,30 +182,8 @@ class BaseTemplate(object):
         rcontext = {}
         self.cook_check()
         stream = self.output_stream_factory()
-        try:
-            self._render(stream, econtext, rcontext)
-        except:
-            cls, exc, tb = sys.exc_info()
-            errors = rcontext.get('__error__')
-            if errors:
-                formatter = exc.__str__
-                if isinstance(formatter, ExceptionFormatter):
-                    if errors is not formatter._errors:
-                        formatter._errors.extend(errors)
-                    raise
-
-                formatter = ExceptionFormatter(errors, econtext, rcontext)
-
-                try:
-                    exc = create_formatted_exception(
-                        exc, cls, formatter, RenderError
-                    )
-                except TypeError:
-                    pass
-
-                raise_with_traceback(exc, tb)
-
-            raise
+
+        self._render(stream, econtext, rcontext)
 
         return join(stream)

```
I still have the overflow.

If I instead raise an Exception when the stack length is half the size of the recursion limit, i.e.:
```
            import inspect
            if len(inspect.stack()) * 2 > sys.getrecursionlimit():
                raise Exception('Hey')
```
the exception is properly reported. 
Reminds me of a problem in a customer project a couple of years ago, probably Plone 4. On Mac the recursion limit is around 200 IIRC. On a page that did a lot of work and took long,we had a crash on Mac but not on Linux. Either increasing or decreasing the limit fixed the crash. So it was not a really endless recursion. If the exception happened in the wrong place, the crash happened.
Perhaps a few spots where we catch several exceptions but reraise a KeyboardInterrupt so Zope can handle it, we can also catch and reraise RecursionLimit. 
I can't reproduce this issue on a Mac.

Can you try and test with this changeset https://github.com/malthe/chameleon/compare/add-recursion-limit-error-test – I updated it to catch and immediately raise `RuntimeError` (on Python 3: `RecursionError`).
@malthe tried and failed :)

This happens when I add a pdb before the raise:
```
[613] > /home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py(190)render()
-> raise
(Pdb++) ll
[603] > /home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py(190)render()
-> raise
(Pdb++) import inspect
(Pdb++) len(inspect.stack())
614
(Pdb++) c
2019-02-05 18:24:54,323 ERROR [plone.app.viewletmanager:118][waitress] Error while rendering viewlet-manager=plone.toolbar, viewlet=plone.contentviews
Traceback (most recent call last):
  File "/home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py", line 
...
RecursionError: maximum recursion depth exceeded while calling a Python object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
....
Fatal Python error: Cannot recover from stack overflow.

Thread 0x00007f6161306700 (most recent call first):
...
```
This cannot be reproduced in a pure Zope4.

It only happens in Plone 5.2 in Python 3. In Plone 5.2 with Python 2 it does not happen (neither with ZServer nor with WSGI).
I spent some more time with this but could not fix it. I found out that the issue does not appear when the template in question is very simple and it happens less (i.e. only at a higher complexity) when using the Zope master with Plone. 

I'm fairly certain that it would also happen in pure Zope without Plone if the template in question was rather complex. That would be my next approach to simplify the involved stack but working on this cannot be considered fun so I'll leave it for now.
Calling the view from the same view will naturally result in a infinite recursion in any version of Plone with any version of Python. How is this a bug?
Sorry, I see. The infinite recursion is expected, the instance dying is not.
Yes, possibly somehow an attack vector e.g. by ttw customizations (Rapido or so)...
I am looking in to this. 
I think this is a chameleon issue.
@malthe @MatthewWilkes do you have some suggestions?
I think this is something related to https://github.com/malthe/chameleon/commit/913abdede94fbb716c6cd2ed6519e99c3521547c
Note that if I lower the recursion limit to 999 (with `sys.setrecursionlimit(999)`) everything works fine.
The default for the recursion limit is 1000.
"Overflowing while handling an overflow. Give up."

I think the exception handling logic should check if an error is a recursion error and in that case not attempt to do any fancy stuff.

It would be great with a test in Chameleon proper showing this behavior.
Wow, I don't recognise much of my thinking from that old PR. I obviously didn't keep thr chameleon magic in my brain.

I think special casing recursion makes sense, but will that make it hard to find the cause of the exception because of less informative exceptions?

Also, I think as this is now a released version we probably need to do security response. I'll ping the team.
No success reproducing but I didn't use a lot of effort either:

https://github.com/malthe/chameleon/compare/add-recursion-limit-error-test?expand=1
@malthe I also tried something similar:
```
    def test_render_pt_with_infinite_recursion(self):
        template = self.from_string(
            '''
            <tal:defs define="foo python:view(view=view)" />
            ''')
        result = template(view=template)
```
and had a proper traceback.
It seems that the stack overflow is triggered when you have something more complex and it has nothing to do with the exception handling, i.e. with this patch:
```diff
diff --git a/src/chameleon/template.py b/src/chameleon/template.py
index d6c63d9..b47ec27 100644
--- a/src/chameleon/template.py
+++ b/src/chameleon/template.py
@@ -179,30 +182,8 @@ class BaseTemplate(object):
         rcontext = {}
         self.cook_check()
         stream = self.output_stream_factory()
-        try:
-            self._render(stream, econtext, rcontext)
-        except:
-            cls, exc, tb = sys.exc_info()
-            errors = rcontext.get('__error__')
-            if errors:
-                formatter = exc.__str__
-                if isinstance(formatter, ExceptionFormatter):
-                    if errors is not formatter._errors:
-                        formatter._errors.extend(errors)
-                    raise
-
-                formatter = ExceptionFormatter(errors, econtext, rcontext)
-
-                try:
-                    exc = create_formatted_exception(
-                        exc, cls, formatter, RenderError
-                    )
-                except TypeError:
-                    pass
-
-                raise_with_traceback(exc, tb)
-
-            raise
+
+        self._render(stream, econtext, rcontext)
 
         return join(stream)

```
I still have the overflow.

If I instead raise an Exception when the stack length is half the size of the recursion limit, i.e.:
```
            import inspect
            if len(inspect.stack()) * 2 > sys.getrecursionlimit():
                raise Exception('Hey')
```
the exception is properly reported. 
Reminds me of a problem in a customer project a couple of years ago, probably Plone 4. On Mac the recursion limit is around 200 IIRC. On a page that did a lot of work and took long,we had a crash on Mac but not on Linux. Either increasing or decreasing the limit fixed the crash. So it was not a really endless recursion. If the exception happened in the wrong place, the crash happened.
Perhaps a few spots where we catch several exceptions but reraise a KeyboardInterrupt so Zope can handle it, we can also catch and reraise RecursionLimit. 
I can't reproduce this issue on a Mac.

Can you try and test with this changeset https://github.com/malthe/chameleon/compare/add-recursion-limit-error-test – I updated it to catch and immediately raise `RuntimeError` (on Python 3: `RecursionError`).
@malthe tried and failed :)

This happens when I add a pdb before the raise:
```
[613] > /home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py(190)render()
-> raise
(Pdb++) ll
[603] > /home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py(190)render()
-> raise
(Pdb++) import inspect
(Pdb++) len(inspect.stack())
614
(Pdb++) c
2019-02-05 18:24:54,323 ERROR [plone.app.viewletmanager:118][waitress] Error while rendering viewlet-manager=plone.toolbar, viewlet=plone.contentviews
Traceback (most recent call last):
  File "/home/ale/Code/plone/buildout.coredev.alpine/src/chameleon/src/chameleon/template.py", line 
...
RecursionError: maximum recursion depth exceeded while calling a Python object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
....
Fatal Python error: Cannot recover from stack overflow.

Thread 0x00007f6161306700 (most recent call first):
...
```
This cannot be reproduced in a pure Zope4.

It only happens in Plone 5.2 in Python 3. In Plone 5.2 with Python 2 it does not happen (neither with ZServer nor with WSGI).
I spent some more time with this but could not fix it. I found out that the issue does not appear when the template in question is very simple and it happens less (i.e. only at a higher complexity) when using the Zope master with Plone. 

I'm fairly certain that it would also happen in pure Zope without Plone if the template in question was rather complex. That would be my next approach to simplify the involved stack but working on this cannot be considered fun so I'll leave it for now.

Resolving patch:
diff --git a/Products/CMFPlone/browser/main_template.py b/Products/CMFPlone/browser/main_template.py
--- a/Products/CMFPlone/browser/main_template.py
+++ b/Products/CMFPlone/browser/main_template.py
@@ -1,28 +1,31 @@
 # -*- coding: utf-8 -*-
-from zope.interface import implementer
-
+from Products.CMFPlone.browser.interfaces import IMainTemplate
 from Products.Five import BrowserView
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-
-from Products.CMFPlone.browser.interfaces import IMainTemplate
+from zope.interface import implementer
 
 
 @implementer(IMainTemplate)
 class MainTemplate(BrowserView):
 
-    ajax_template = ViewPageTemplateFile('templates/ajax_main_template.pt')
-    main_template = ViewPageTemplateFile('templates/main_template.pt')
+    ajax_template_name = 'templates/ajax_main_template.pt'
+    main_template_name = 'templates/main_template.pt'
 
     def __call__(self):
-        return self.template()
+        return ViewPageTemplateFile(self.template_name)
 
     @property
-    def template(self):
+    def template_name(self):
         if self.request.form.get('ajax_load'):
-            return self.ajax_template
+            return self.ajax_template_name
         else:
-            return self.main_template
+            return self.main_template_name
 
     @property
     def macros(self):
-        return self.template.macros
+        # Reinstanciating the templatefile is a workaround for
+        # https://github.com/plone/Products.CMFPlone/issues/2666
+        # Without this a inifite recusion in a template
+        # (i.e. a template that calls its own view)
+        # kills the instance instead of raising a RecursionError.
+        return ViewPageTemplateFile(self.template_name).macros


Test patch: