How To Troubleshoot The Error "Could Not Start Executor. Creating User Session Timed Out"?

Robots cannot run jobs and this error" System.Exception: Could not start executor. Creating user session timed out." is thrown.

Summary:
This knowledge base (KB) article offers insights into the problem, potential underlying causes, and a detailed troubleshooting guide for addressing the "System.Exception: Failed to start executor. Creating user session timed out" error that occurs when attempting to execute unattended jobs in Orchestrator.

Symptom:
The issue surfaces when initiating Robots from Orchestrator, whether through manual or scheduled triggers. The problem manifests as the job status swiftly transitioning to "Failed," with a notable absence of logs being generated throughout the process execution.

Below, a potential sequence of errors can be found in the Event Viewer of the affected Robot's computer when replicating the issue:

  • From the UiPath Robot machine:

"The Desktop Window Manager has registered the session port."

"UiPath.Service.Host 23.4.1.0
Failed to connect sessions dump:
{ SessionId = 0, State = WTSDisconnected, IsSessionLocked = False, User = , ClientName = }
{ SessionId = 1, State = WTSConnected, IsSessionLocked = False, User = , ClientName = }
{ SessionId = 2, State = WTSDisconnected, IsSessionLocked = False, User = [REDACTED], ClientName = }
{ SessionId = 3, State = WTSActive, IsSessionLocked = False, User = [REDACTED], ClientName = [REDACTED] }
{ SessionId = 65536, State = WTSListen, IsSessionLocked = False, User = , ClientName = }
{ SessionId = 65537, State = WTSListen, IsSessionLocked = False, User = , ClientName = }
{ SessionId = 65538, State = WTSListen, IsSessionLocked = False, User = , ClientName = }"

"UiPath.Service.Host 23.4.1.0
Screenshot taking at: [REDACTED]"

"UiPath.Service.Host 23.4.1.0
StartProcessInMonitoredSession failed."

"UiPath.Service.Host 23.4.1.0
System.TimeoutException: Creating user session timed out.
---> System.OperationCanceledException: async () => await IsSessionReady()
at UiPath.Session.WaitFor.Predicate(Func`1 predicate, CancellationToken ct, String expression)
at UiPath.Session.Internals.WtsApiExtension.<>c__DisplayClass1_0.<g__WaitForSessionToBeReady|0>d.MoveNext()
--- End of stack trace from previous location ---
(…)"

"UiPath.Service.Host 23.4.1.0
[REDACTED] finished with Failed (was Preparing)
System.Exception: Could not start executor. Creating user session timed out."

Root Cause: It seems that a timeout problem arises when attempting to establish new user sessions for robot execution of processes. The occurrence of System.TimeoutException and System.OperationCanceledException errors suggest prolonged session creation, leading to eventual cancellation. Various factors could contribute to this issue, including:

  1. Elevated resource utilization on machines running the robots, potentially impeding the session creation process.
  2. Misconfigurations in Robot settings or Orchestrator that may be hindering session creation. Refer to the documentation on Connecting Robots to Orchestrator for recommended practices.
  3. Possible challenges or modifications in the underlying infrastructure of the machines (e.g., network latency, server performance issues, or other relevant factors).
  • From the UiPath Orchestrator:
Example of Faulted Job in Orchestrator due to related error

Job Error Details

For troubleshooting, follow these steps:

  1. Configure Session Timeout: Set a system variable on the Robot computer named UIPATH_SESSION_TIMEOUT with a value in seconds. Consider a higher value, e.g., 300 seconds, to address timeout issues. Frequently Encountered Robot errors page for more details.
  2. Prevent Open Sessions: Ensure automation processes close all applications by incorporating the "Kill Processes" activity for applications used during execution. This helps prevent lingering open sessions
  3. Monitor Resource Utilization: Keep an eye on resource usage (CPU, Memory, Disk, and Network) on machines hosting the Robots. Optimize processes or allocate additional resources if high utilization is observed.
  4. Managing Disconnected Sessions: Configure a policy to limit the time a disconnected session remains active on the server.
    1. Press the Win + R keys on your keyboard to open the "Run" dialog
    2. Type "gpedit.msc" into the dialog box and press Enter or click "OK." This will open the Local Group Policy Editor
    3. Navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Session Time Limits
    4. Double-click "Set time limit for disconnected sessions", click Enabled, select the appropriate time from the dropdown menu
    5. Click Apply and then click OK to save the changes
    6. Restart the machine to apply the changes and test the job execution.
Limit Disconnected Sessions
  1. Internal IT Department Support and Verifications: Contact support from the Systems department to further investigate possible infrastructure-related issues. They should be able to perform network troubleshooting, server performance analysis, and other essential checks to identify if the underlying infrastructure has any bottlenecks or issues causing the problem. Provide the feedback to UiPath Support.


Additional Information:

  1. Depending on the version of UiPath Orchestrator and UiPath Robot, an error related to the creation of sessions may occur as follows:
  • "System.Exception: Could not start executor. A specified logon session does not exist. It may already have been terminated. (0x80070520)"