"Did not receive port from client process." when running jobs

"Did not receive port from client process." when running jobs

Version: Any 
When executing jobs, jobs can fail without starting the PowerShell script. Within the PowerShell Universal logs, you will see an error that states: Did not receive port from client process.
Root Cause:
When running in non-integrated environments, PowerShell Universal jobs are started as external PowerShell processes. Each job will start a new process. When a process is started a communication channel is established to send input and output from the scripts to be stored and displayed within PowerShell Universal. There is a, by default, 5 second time out that the server will wait for the process to communicate back to the server. If this does not happen you will see a "Did not receive port from client process" error within the logs. 
There are several ways to work around this issue. Typically, this issue occurs when the server is under load and cannot start the processes fast enough. 
Increase Job Timeout
You can increase the timeout of job handshakes. This setting is available in appsettings.json. The following setting increases the job handshake timeout to 30 seconds. 
  1.   "UniversalAutomation": {
        "JobHandshakeTimeout": 30,
        "JobDebugging": false,
        "ContinueJobOnServerStop": false
Reduce Number of Concurrent Jobs
Limiting the number of concurrent jobs can alleviate this issue as well. By reducing the number of jobs running on the system, the jobs will have more resources to use and will not timeout when starting. When the job queue is smaller, jobs will wait to be started before additional jobs are started. This setting is available within the Settings \ General page. By default, the concurrent job limit is 1000. You can try to reduce it as low as you like to avoid this issue. 
Increase Resources
Finally, you can also increase resources on the PowerShell Universal system to attempt to avoid this issue. Since the issue is that the jobs are not starting in time, increasing the resources on the machine may improve the jobs ability to complete the handshake within the timeout. 

    • Related Articles

    • Jobs not returning correctly from Get-PSUJob

      Version: 1.5 Issue: When running Get-PSUJob and passing in a script returned from Get-PSUScript, jobs may not be returned correctly.  Get-PSUScript -Name 'Script.ps1' | Get-PSUJob  Root Cause: If the Universal 1.4 PowerShell module is installed, and ...
    • IIS: HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

      Applies to: PowerShell Universal 1.4 or later When configuring PowerShell Universal to run under IIS, you may be presented with an error that states ANCM Out-Of-Process Startup Failure. This error can be presented for a variety of reasons but the ...
    • "[WARN] Call failed. An error occurred while sending the request." message in all jobs

      Version: Any Root Cause When PowerShell Universal starts a new job, it uses the Management API to retrieve job information from the server. It does this over HTTP and will generate a Read-Only app token for the identity of the user that started or ...
    • Out-String doesn't work in Universal Dashboard

      Product: PowerShell Universal - Any Version  Issue: Out-String does not appear to work in PowerShell Universal Dashboard running in Windows PowerShell v5.1. You will receive empty strings when attempting to use Out-String. See the example below for ...
    • KB0024 - Moving a PowerShell Universal to a new git remote

      Purpose The purpose of this document is to provide the steps necessary to migrate a PowerShell Universal git repository from one remote to another. Overview PowerShell Universal does not provide this functionality directly in the platform. You will ...