Session Hosts Hanging Frequently

Brass Contributor

Wondering if anyone else is seeing regular VM hangs with the Windows 10 Enterprise for Virtual Desktops image, or has any advice on troubleshooting the issue we're experiencing?

 

In our tenant we have 14 session hosts (each has 16 vCPU, 64GB RAM, 256GB Premium SSD) in a single host pool. FSLogix Apps is used for profiles and they're stored on a Premium Azure Files Storage Account (5TB Quota, 5000 allowed IO/s, 15000 burst IO/s) in the same region as the hosts. There are 225 users that use WVD for a full desktop environment (no RemoteApps).

 

Average CPU and RAM usage during peak time is less than 50% per VM.

 

Almost every day, usually during peak hours, at least one of the VMs hangs and needs to be restarted from the Azure portal. Users that are connected to the affected VM report that none of their opened applications are responsive, and that they can’t launch or close any applications, even using task manager. The start menu also becomes unresponsive.

 

Any new connections (via Remote Desktop client or directly via RDP) fail.

 

If we try to log off users using the "Invoke-RdsUserSessionLogoff" cmdlet, their session hangs at the "Signing you out" screen indefinitely.

 

If we try to kill any of their processes using task manager (as an admin) we get an Access Denied error message, or the process doesn’t get killed.

 

Typically in the event logs, about 30 minutes prior to the VM hanging, we start to a few of following events, but there is no commonality between applications, servers or users in the event descriptions.

 

1002 – Application Hang
7036 – Services entering a stop state
7011 – A timeout was reached wile waiting for a response from a service

4 Replies

@DanRobb 

 

I have seen this exact behavior, but the culprit was storing the profiles in blob storage.  After moving to SMB, our lock ups went away.

 

1 question, did you enable Known Folders for OneDrive?  I've been testing that option and think there may be issues with it locking up the box but I'm not certain.

@evgaff 

 

We're using Azure Files (not blob storage) and connecting to it over SMB. Are your profiles still stored in an Azure storage account, or did you move them to a file server?

 

Yes, we've enabled known folders with OneDrive.

 

 

 

 

@DanRobb did you ever figure this out?

@Robin_Kinetix 

 

We were never able to figure out a proper solution despite months of back and forth with MS Support.

 

I ended up creating a scheduled task to reboot on the hosts every 8 hours (if nobody is logged in) which has reduced the frequency of the hangs from once every few days to once every few weeks/months.

 

Here's the Powershell script that is called by the scheduled task - it runs every 5 minutes.

$minHoursBetweenReboots = 8 # Minimum number of hours between reboots

function Write-Log($logMessage)
{
    $logFile = "$($PSScriptRoot)\ScheduledRestart.log"
    Write-Output "[LOG] [$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")] $logMessage"
    Write-Output "[LOG] [$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")] $logMessage" | Out-File $logFile -Append
}

Write-Log "Start of script"

function End-Script
{
    Write-Log "End of script"
    exit 0
}

# Check for running installations. If any, then exit
if((Get-Process).Name -match "msiexec|setup|wusa")
{
    Write-Output "Detected software installation in progress. Exiting..."
    End-Script
}

# Check for active sessions. If any, then exit
[array]$activeSessions = & query session | Select-String -SimpleMatch "Active"
if($activeSessions.Count -gt 0)
{
    Write-Log "There are $($activeSessions.Count) active sessions. Exiting..."
    End-Script
}
else
{
    Write-Log "There are no active sessions"
}

# Get last boot time
try
{
    $osInfo = Get-WmiObject -Class Win32_OperatingSystem
    [datetime]$lastBootTime = $osInfo.ConvertToDateTime($osInfo.LastBootUpTime)
    Write-Log "Last boot time: $lastBootTime"
}
catch
{
    Write-Log "ERROR: Unable to get last boot time. Exiting..."
    End-Script
}

# If more than $minHoursBetweenReboots since last boot time then reboot
if($lastBootTime -lt (Get-Date).AddHours(-$minHoursBetweenReboots))
{
    Write-Log "Last boot time was more than $minHoursBetweenReboots hours ago. Restarting..."
    & shutdown -r -t 0 -f -c "Restart initiated by scheduled task/powershell script"
}
else
{
    Write-Log "Last boot time was less than $minHoursBetweenReboots hours ago. Exiting..."
    End-Script
}
End-Script