ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
37 stars 4 forks source link

CPU usage at 100% when running script on 'All Computers' in a one node / single instance setup #1975

Closed schubfre closed 1 year ago

schubfre commented 1 year ago

Steps to Reproduce

This happens with every script, but for example take the script below and then instead of leaving the "Run On" field blank or selecting 'Any Computer' or the actual instance name, -> select 'All Computers'

$Parameters = @{
    Name = "HelloWorld.ps1"
    Path = "HelloWorld.ps1"
    ErrorAction = "Stop"
    InformationAction = "SilentlyContinue"
}
New-PSUScript @Parameters
[cmdletbinding()]
Param(
    [Parameter(Mandatory = $true)]
    # [ValidatePattern('^[a-zA-Z0-9\-]{1,15}$')]
    [string]
    $Servername,

    [Parameter(Mandatory = $false)]
    [boolean]
    $GenerateError
)

if ($GenerateError -eq $true) {
    throw "This is an error"
}

$Output = @{
    'servername' = $Servername;
}

return $Output

Expected behavior

Script is run on the only node / instance that is configured in PSU

Actual behavior

CPU usage goes to 100% and doesn't let up. Stopping the service doesn't work. Only killing the process and starting the service again brings PSU down to normal

Environment data

PSU 3.7.6 Windows Server 2022 Single instance / not clustered LiteDB Connected to git

Visuals

image

schubfre commented 9 months ago

@adamdriscoll I think there might have been a regression somewhere down the line. I am experiencing the same behaviour on 3.10.2 and 4.2.11 (partially)