Otter - PowerShell Remnants and High Memory Usage
I raised this issue a while back but the Forum and I agreed that we thought it was something else and I was happy for the issue to be closed. Now I am using Otter in full flight mode, I'm seeing the problem re-occurring and wanted to re-open it for further diagnosis.
When using Otter and launching other processes from it (which are command line, silent), Otter is still keeping the powershell.exe process open even after a successful configuration run. Overtime this means that memory usage creeps up, eventually making the box unusable. The processes can be shut down by either force closing otter_agent.exe which cascades the close down or by using taskkill.exe /im:powershell.exe /f. However this is manual intervention which makes widespread use of it difficult - the whole advantage of Otter is not logging on to remote terminals!
I have tried the following to rectify this:
- Ensuring servers are only in one role.
- Restarting the service via the Web GUI (which restarts the Execution Dispatcher role).
- Removing any Otter Ensure scripts from the run.
- Restarting the service on the box.
I only noticed this when my monitoring window started showing excessive memory usage and sure enough Otter's PowerShell has hogged it all. From a programming perspective I can understand (although not agree with) if a configuration run fails that PowerShell might stick around for that individual process (if the Otter Agent can't tell it's hung or waiting for an issue). However, on a successful run there seems no explanation for this - can the last action of the Otter agent on a successful run not be to shut down any owned PowerShell scripts? Furthermore, I am unsure as to why if there are four PS scripts in the Otter script, all four stay around even when only one has the EXE launch in it.
I cannot prove that it is the EXE causing this problem but can confirm that:
- The other server roles which do not have the EXE launches are NOT affected.
- The EXEs are all using Start-Process with a -Wait. However, they all do successfully complete.
For information I am using the following EXES:
- Certutil - to import certificates (in enterprise mode)
- Openssl - to generate certificates.
I did try the workaround that was suggested - to wrap the PowerShell in an Otterscript with a timeout but that didn't work either.
Sorry for the long post!