PSU App Randomly becomes unresponsive

Body:

I’m troubleshooting an intermittent issue with one of our production PowerShell Universal apps and would appreciate any insights or suggestions.

Environment

  • PowerShell Universal v5.5.2
  • Custom PowerShell 7 environment (pwsh 7.5)
  • Max runspaces set to 200 (configured in environment settings)
  • Unlimited virtual memory
  • Hosted on Windows Server 2022, using MSSQL and the built-in web server
  • 4 CPU, 24GB RAM
    • Generally this stays about 5% cpu/35% memory usage

Issue

We have a PSU that exposes several Pages to manage mostly on-prem AD accounts, but there are also some Graph calls. It generally works fine, but 2–3 times per week, it becomes completely unresponsive. When this occurs:

  • The affected app won’t load or refresh
  • Other PSU apps and scripts remain fully functional
  • Restarting the app (via PSU admin interface) immediately resolves the issue

What I’ve Tried

  • Enabled the built-in “Excessive Runspace Usage” health check which never triggers (threshold set to 50)
  • No high CPU or RAM usage on the server during hangs
  • No logged errors or warnings around the time of freeze. Debug logging is enabled.
  • Audited and optimized AD queries:
    • Replaced unconstrained Get-ADUser calls
    • Using -Filter * with -ResultSetSize and -ResultPageSize capped at 200
  • Verified via the Diagnostics → Runspaces view that the environment does spin up many idle runspaces (10+), so scaling appears functional
  • When the app is frozen, the Sessions list in the PSU Admin UI is empty, except for a possible Security runspace

Questions

  1. Are there any known issues with runspace cleanup, orphaned sessions, or resource locking that might cause an app-level freeze?
  2. Is it possible for a PSU App to exhaust or block all runspaces in a way that doesn’t trigger the built-in health check?
  3. Could this be a case of thread pool starvation or something PSU 5.5.2 may have fixed/addressed in a later version?Bottom of Form

It seems that upgrading to 5.6.0 fixed my issues. Specifically, I believe this bug fix. Environment Recycling · Issue #4703 · ironmansoftware/powershell-universal · GitHub