Jobs of type "External" are executed in a separate process: the StdioProcessor.exe
process. But after such jobs are finished by the Jobservice the process will not end, the process keeps running for some time. If a new external job has to be executed during this time, the currently running process will be reused.
Sometimes (e.g. for Exchange jobs) the used memory will not be released after the job was finished (there are known memory leaks in Exchange Powershell sessions). That can result in StdioProcessor.exe taking more and more memory until it will crash with the "out of memory" error.
The solution is to define a limit for the reusage of the external processes. This can be done via the Jobservice configuration:
1. Open the Job Service Configuration
2. Select the Queue under "Job Destination"
3. Change the "Value" field for "Max. External processor reusage count"
The default value for this setting is "0" meaning "unlimited". Start by testing values of 10 or 20. That means that the StdioProcessor.exe will be closed (and will release the utilized memory) after this count of jobs.
You should monitor the behavior as a larger value (e.g. 50 or 100) may resolve the issue. It depends on the specific environment, the hardware of the Jobservice, the count of jobs, and so on.
Please see Knowledge Article 121260
, Error: "Exception of type 'System.OutOfMemoryException' was thrown"
, for more details.