Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Limit max recursion depth by default. #1200

Closed
wants to merge 1 commit into from

Conversation

kunom
Copy link
Contributor

@kunom kunom commented May 9, 2015

Related to #1192.

@jdhardy
Copy link
Member

jdhardy commented May 11, 2015

Unfortunately the RecursionLimit is basically ignored. You would also need to track every python stack frame entry/exit and break when the limit is hit. It's probably possible but I'm not sure what the performance hit might be.

@DinoV
Copy link
Member

DinoV commented May 11, 2015

The reason why this is disabled by default is due to performance issues and there'll be a significant hit to function call performance from enabling this by default. I don't think the limit is ignored though currently, we should do the proper enforcement every time a function is called, and someone hitting the issue here can always run with -X:RecursionLimit set

@kunom
Copy link
Contributor Author

kunom commented May 13, 2015

jdhardy, I am sorry but I need some more time to be able to follow your comment. At least in my tests with hasattr, setting a recursion limit worked.

DinoV, can you elaborate a bit more on what the exact significant performance issues are with enforcing the recursion limit? Is it the counter management in PythonFunction.AddRecursionDepth()? From a naive standpoint, enforcing the recursion limit is not more than incrementing, decrementing and comparing an integer.

Regarding #1192, I don't see an other way to achieve CPython compatiblity since StackOverflowExceptions are normally uncatchable since .NET 2.0. (In fatch, there is already a catch-all handler in PythonOps.HasAttr()).

@slide
Copy link
Contributor

slide commented Jun 9, 2017

If you would like to recreate this PR, please do so under IronLanguages/ironpython2

@slide slide closed this Jun 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants