Closed andrewstein closed 7 months ago
Hi @andrewstein, unfortunately, we don't support setrecursionlimit
, it has no effect. The way to change the maximum recursion depth is to set the stack size for the underlying JVM/SubstrateVM. You can do it with --vm.Xss8M
(sets the stack size to 8 MB).
If you're hitting the RecursionError
in code that is not deeply recursive, you're probably hitting a bug that should be resolved in GraalPy 23.1, so I would strongly recommend upgrading.
Thanks @msimacek set JVM option -Xss8M
on 21-graalce
and 17.0.8-graalce
both worked
Closing. You can set stack size via the JVM options as mentioned. It's not possible for us to support sys.setrecursionlimit
on the JVM.
I have created a python context inside Java using
Context context = Context.create("python");
and using that context to run some python code. The code errors out with "RecursionError: maximum recursion depth exceeded".Similar code seems to run just fine from the
graalpy
command line.On the command line I have:
Going back to the java
Context
with this code I get a value of 1000.If I explicitly call
sys.setrecursionlimit(20000)
in the JavaContext
, thensys.getrecursionlimit()
will return 20000, but it seems that this does not effect the original code that I was trying to run.I could not find documentation on how to set the recursion limit when creating the
Context
.Bottom line: either allow
sys.setrecursionlimit
to have effect when called from a JavaContext
, or allow one to set the recursion limit when creating the context.