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

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

Version: Any 
Problem:
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. 
Workaround:
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

    • KB0038 - Privilege is not help by client

      Applicability This article applies to users running PowerShell Universal 3.x and 4.x who are attempting to run scripts are alternate users. The issue presents itself as an error while attempting to run scripts that states: Error running script. A ...
    • 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 ...
    • KB0069 - PowerShell Universal Startup Process

      Purpose The purpose of this document is to outline the steps that PowerShell Universal takes when starting up. Process 1. Insert current product version and install date in database Updates the database with a record about the current product version ...
    • 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 ...
    • KB0057 - Scheduled Jobs are Not Shown in the Script \ Jobs Tab

      Affected Versions - PowerShell Universal 4.2.0 - 4.2.4 Problem When viewing a script's jobs within the script's page, scheduled scripts will not be shown. Root Cause A change was introduced to allow for filtering out scheduled jobs. The script's page ...