You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hit this with an import/sync script, where we call the plone.api.env.adopt_user several times. So, it was more than 100 times.
Traceback (most recent call last):
File "/data/eggs/Zope2-2.13.27-py2.7.egg/OFS/SimpleItem.py", line 242, in raise_standardErrorMessage
v = s(**kwargs)
File "/data/eggs/Products.CMFCore-2.2.10-py2.7.egg/Products/CMFCore/FSPythonScript.py", line 127, in __call__
return Script.__call__(self, *args, **kw)
File "/data/eggs/Zope2-2.13.27-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
return self._bindAndExec(args, kw, None)
File "/data/eggs/Zope2-2.13.27-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 351, in _bindAndExec
security.addContext(self)
File "/data/eggs/AccessControl-3.0.11-py2.7-linux-x86_64.egg/AccessControl/ImplPython.py", line 603, in addContext
raise SystemError, 'Excessive recursion'
SystemError: Excessive recursion
adopt_user is a context manager. On __enter__ it gets the current security-manager, remembers it, creates a newSecurityManager and sets it. On __exit__ it sets back to the old security-manager.
Now, if a new SecurityManager is created all is fine.
But if then something is executed, that binds the new security-manager, like Shared.DC.Scripts.Bindings._bindAndExec, it calls the security-managers method addContext which holds a stack of all contexts on the current request. And this stack is limited to 100 . An environment variable Z_MAX_STACK_SIZE will override this if needed (even if the docs are telling me this would be esoteric - really!).
This is a bug, because when we set back to the old security manager, we are also responsible to clean up the context stack to its previous settings. Since the context is always the same (current request), this is logic-wise not a problem.
One solution would be to read the length of the stack and slice the lengths afterwards to its previous value.
After all, it helped to start with Z_MAX_STACK_SIZE=100000 ./bin/instance fg for me in this case.
The text was updated successfully, but these errors were encountered:
I hit this with an import/sync script, where we call the
plone.api.env.adopt_user
several times. So, it was more than 100 times.adopt_user
is a context manager. On__enter__
it gets the current security-manager, remembers it, creates a newSecurityManager and sets it. On__exit__
it sets back to the old security-manager.Now, if a new SecurityManager is created all is fine.
But if then something is executed, that binds the new security-manager, like
Shared.DC.Scripts.Bindings._bindAndExec
, it calls the security-managers methodaddContext
which holds a stack of all contexts on the current request. And this stack is limited to 100 . An environment variableZ_MAX_STACK_SIZE
will override this if needed (even if the docs are telling me this would be esoteric - really!).This is a bug, because when we set back to the old security manager, we are also responsible to clean up the context stack to its previous settings. Since the context is always the same (current request), this is logic-wise not a problem.
One solution would be to read the length of the stack and slice the lengths afterwards to its previous value.
After all, it helped to start with
Z_MAX_STACK_SIZE=100000 ./bin/instance fg
for me in this case.The text was updated successfully, but these errors were encountered: