ironmansoftware / powershell-universal

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

Multiple API Endpoints returns what appears to be a cached response from another single API Endpoint #4079

Closed chauberg closed 5 days ago

chauberg commented 6 days ago

Description of Issue

I'm sorry that details are going to be scarce on this one but focus was on restoring normal operation.

Yesterday we experienced an issue with multiple of our API Endpoints returning what looked like a cached (or maybe just the most recent) response from another Endpoint.

The only notable thing we could find in the log was this: (xxx is redacted a server name)

2024-11-19 10:53:34.897 +01:00 [INF][] GET /api/Server/xxx/Location ::ffff:10.253.2.45 2024-11-19 10:53:35.145 +01:00 [ERR][] Cannot process command because of one or more missing mandatory parameters: mode. 2024-11-19 10:53:35.147 +01:00 [INF][] Status: 400 Content-Type: application/json Length: 120

This would repeat a lot but only for this endpoint, here's the endpoint code: return ((Get-ADComputer $servername | Select-Object -ExpandProperty DistinguishedName) -split "," | Select-Object -Skip 1) -join "," | ConvertTo-Json

Now "mode" is a mandatory parameter of another endpoint but that endpoint and others were returning results from the /api/Server/xxx/Location endpoint.

A restart of PSU fixed the issue and the endpoints are working as expected now, I also turned off Persistent Runspaces on the Environment the APIs are running on just in case that's related.

Version

5.0.15

Severity

High

Hosting Method

MSI (Windows Service)

Operating System

Windows

Database

SQL

Licensed

Yes

Features

Git sync, SAML

Additional Environment data

No response

Screenshots/Animations

No response

adamdriscoll commented 5 days ago

This was a problem with persistent runspaces and fixed in .16.