...
You disconnect or fail to connect to a new or existing Horizon virtual desktop session.An event will be recorded within the horizon console event database:AGENT_PENDING_EXPIRED An event will be recorded in the windows events of the virtual desktop "Warning","104","08/12/2022 14:50:40","VMware View","9","NT AUTHORITY\SYSTEM","AGENT_PENDING_EXPIRED The pending session on machine testvdifor user test\testuser has expired Logging within Horizon will also indicate this: 2022-12-02T08:41:20.659-05:00 WARN (0C48-0C90) <TimerService> [wsnm_desktop] The allocated session for user test\testuser has not been connected from the client within the allocated time, this may be due to a failure to make the protocol connection or an inability to log the user into the available session 22-12-02T08:41:20.659-05:00 WARN (0C48-0C90) <MainWndLoop> [wssm_desktop] Session manager has been asked to stop as session with sessionId=4 is logging off,notifying the service to block reconnects while this completes.
The Horizon client sends keepalive messages to the servers; if they don't arrive, the session ends after a period. This is a deliberate event designed to ensure session stealing cannot take place. The o/s may take longer to log off the session but it is inert from the horizon side.
There can be several reasons behind an AGENT_PENDING_EXPIRED message.Client-Driven Expiries: The heartbeat interval (set-last-user-activity) is capped at 30 minutes. If this interval expires, the session is expired.You can see these being sent and received within the horizon client logs. 2022-12-02T08:41:20.659-05:00 INFO (01) [libcdk] : CdkSetLastUserActivityTask_CreateRequest: Sending last user activity: 349. 2022-12-02T08:21:20.659-05:00 vmware-view 20686| CdkTunnelClient_DisconnectCb: TUNNEL INTERRUPTED: Error: Client disconnected due to lack of activity. Typically, when you see a client disconnected due to the lack of a heartbeat (set-last-user-activity) response, it indicates a networking/persistence issue with the session.Please find resources on this Scenario:Monitoring health of Horizon Connection Server using Load Balancer, timeout, Load Balancer persistence settings in Horizon 7.x and 8 (56636) - this article outlines the timeout settings and recommended load balancer values.Troubleshooting Intermittent Blast Connection Issues in Unified Access Gateway (UAG) (83088) outlines potential reasons why traffic can be misrouted.Guest Operating System Issues:A non-responsive operating system can also cause a heartbeat to not be sent to a client. This is a security feature to ensure a session marked for removal is not re-used. Horizon View Best Practices : Parent Image Creation and Maintenance. (90152) outlines best practices to ensure a healthy image.Confirming that the userinit string is configured properly (1028975) outlines a scenario when an user-init value is misconfigured resulting in the expired message as the session management process fails to start.High CPU usage can result in expired messages on the Agent side. We log High CPU usage in the agent logs to assist in the rapid identification of resource issues: 2022-12-29T13:47:12.013-04:00 INFO (0C34-0C58) <TimerService> [ws_perfmon] High CPU use: pid=6616, sessionId=0 Often, when you match the date and time of the expiry with windows events, there are events indicative of DNS / infrastructure or Application Issues which can interrupt the heartbeat. "Information","26","07/12/2022 23:40:48","Application Popup","0","NT AUTHORITY\SYSTEM","Application popup: NondescriptApp.exe - Application Error : The application was unable to start correctly (0xc0000142). Click OK to close the application." Often if a cause is not immediately evident with windows system event review, you can engage in deeper o/s analysis with the usage of 3rd party tools such as Windows Debugger (WinDbg) to read generated dumps. Guidelines to gather Procmon Trace for End User Computing Support Tickets (82621)Suspending a virtual machine on ESX/ESXi to collect diagnostic information (2005831) Converting a snapshot file to memory dump using the vmss2core tool (2003941) Microsoft Documentation: Generate a kernel or complete crash dumpForcing a System Crash from the Keyboard You can also reduce the frequency of o/s prompted expires by implementing Registry Keys to hasten logoff such as AutoEndTasks – HungAppTimeout – WaitToKillAppTimeout – WaitToKillServiceTimeout Horizon View Desktops hanging on logoff preventing composer operations, or users from logging in (2151503)