-
-
Notifications
You must be signed in to change notification settings - Fork 475
InsufficientExecutionStackException: 5.2.2 looping over psremote session #1974
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
Comments
Hmm interesting. Have you tried the code I posted there to print the size of available stack? Is the number different on first run and on second run? |
it is 230 before and after. updating above issue with code. |
so if i add more items to $apps - it will fail sooner. Hardly a large dataset (array of 20 items with a hash of 3 k/v pairs) |
Final note- no errors/issues running interactively on the host, only remote. |
Not sure if this helps: I added a breakpoint inside the
|
|
I seem to have worked around this issue. Instead of using get-childitem or Get-ItemProperty or other powershell cmds, I am now using dotnet calls, against $HKLM = [microsoft.win32.registrykey]::OpenBaseKey('LocalMachine',"Default") For reasons that are not clear to me, this may be related to PowerShell/PowerShell#5536 |
it's possible that is a red herring now - i think it may be related to nested describe {} stanzas... will test more. |
@nohwnd I'm running into a similar problem when running tests within a WinPS5.1 Job from PS7, it doesn't happen anywhere else, and I know it's not my script because if I reorder the test files, the stacktrace fails in a different place.
Stacktrace in WinPS 5.1 Job right before callstackoverflow (Get-PSCallStack)
Stacktrace in PS7 job (works fine)
|
I managed to tease out the failed objects from the job, the call depth overflow happens here:
|
To reproduce: Checkout https://github.com/JustinGrote/SecretManagement.KeePass and run ./build.ps1 on a windows machine, it'll fail on the Pester Test WindowsPowershell step. If you run only one or two files, the stacktrace error doesn't happen, if you run all test files it will. If you rearrange the test files, it'll generally happen on the third test file, regardless of what it is, similar to @rismoney "running It 3 times to force the issue" Also it tends to happen on a test with a TestCase, tests placed before a TestCase test will pass before hitting the stacktrace limit on the TestCase |
@rismoney @JustinGrote Any chance you both used the Integrated Console mode in VSCode with PowerShell-extension while experiencing this? Just reported a somewhat similar issue in vscode-powershell as I'm only able to reproduce #2174 in vscode Integrated Console using PS5.1 |
Scratch that. Was able to reproduce using jobs in PS 5.1. |
Looks like PSRemoting etc. are running default maxstacksize for it's thread as @nohwnd mentions in this comment. This is only 512KB vs the 10MB used in a normal Windows Powershell session. Marking as external bug/limitation. |
In my use cases, it was not within vscode. It was over a regular powershell enter-pssession on to a windows 2019 server. |
Yes, I'm aware. The referenced comment is confirming that PSRemoting has the same root cause as the vscode extension. The limitation is part of Powershell code itself so we're unable to fix it (increase thread maxstacksize). |
I don't see any potential workaround on our side, and Windows PowerShell is unlikely to take this fix. |
Uh oh!
There was an error while loading. Please reload this page.
Using 5.2.2 and running pester tests over a pssession.
I think this could be related to #822
If you run pester multiple times in a pssession, particular with describe -foreach exhausts the stack fairly easily.
I am basically iterating over an array that has 15 elements, with the elements being 1 level deep hashs:
Then I do a
If I run this multiple times, it may work the 1st time, but definitely not subsequent. In fact the whole session falls apart.
Error message:
InsufficientExecutionStackException: Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.
The text was updated successfully, but these errors were encountered: