-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"call depth overflow" exception in Powershell scripts on Mac #4268
Comments
Can you reproduce with latest version - Beta.4? |
Hi and thanks for your response. I've updated the PS to version 4.0 beta, however it occurred a new issue, so we started looking at it with one of my colleagues, so once we're ready with that, I would try the above described issue with the beta version of PS. |
Could you please add simple repo steps? |
Sure, I would , but currently there is a 'local' problem, that's not connected at all with the PS version. |
I've observed the same issue what you can easily reproduce. Please clone the Pester branch Dev4-1_PSCore_compatibility, check out to the commit 89344732785b862c4c0fcc72050290df6fce9e5f and run tests from the file Functions/Assertions/Be.Tests.ps1. The test result
The failed test is the one that should prevent this kind of situation - it was introduced to Pester here. It works correctly for Windows (2.0 - 6.0.0-beta.8) and Linux (6.0.0-beta.8). The issue was the first reported on PSCore 6.0.0-beta.5. |
Today I've tested it on macOS and PowerShell Core v.6.0.0-beta.9 again. The issue still exists. |
Under the bug reproducing please use exact the code state - the link provided above. Later I've added a condition to don't run the failing test under macOS. |
This seems to be an issue with coreclr. function recurse([int]$i) { $i; recurse ($i+1) }
recurse 0 On Mac, this fails after ~100 iterations |
Can repo on C#? |
Are you hitting the stack limit? Try checking it with |
On both my MacBook Pro and Ubuntu 16.04, it's set to 8192k |
I tried increasing the stack size to 65k, made no difference.. Is anyone looking into this? |
Analyze of the stack limitations on Russian https://habrahabr.ru/post/320970/ I think the code is here. It is under |
@iSazonov enjoy your vacation. Let me try a private patch to see if this fixes this by providing the maxstack parameter. |
Explicitly setting the MaxStack parameter when creating a new thread didn't have any effect even when set to 100MB. |
I found that CoreCLR has a trace but I don't know how turn in it https://github.com/dotnet/coreclr/blob/c440335be80ee0762856d0be6e91ec3ea2f90504/src/pal/src/thread/thread.cpp#L663 |
MacOS set 8MB stack size for process but 512KB for subsequent threads. Windows default is 1 MB ("The default stack reservation size used by the linker is 1 MB.") |
Windows PowerShell Default for local pipeline thread stack size is 10 MB. |
This has nothing to do with stack size. Powershell has implicit limit of max 100 levels of recursion no matter how much stack is left. See the following article, the "PowerShell's Call Depth Limit" section: |
I am sorry, I've not realized that the limit was for powershell 1.0. So please disregard my comment above. |
Currently we set 10 MB stack size for local pipeline threads on all platforms. |
Some of of my PowerShell scripts that I run on Mac failed with the following exception:
"The script failed due to call depth overflow."
After some investigation, I came to the conclusion that the allow call depth in PowerShell v6.0 alpha,
is smaller than the defined in PowerShell v5.0 (which I find is 100).
Could you change or increase in PowerShell for Unix that fixed call depth to be at least 1000?
The text was updated successfully, but these errors were encountered: