Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSLg generates a large number of RdClientAutoTrace files #10216

Open
1 task done
GZTimeWalker opened this issue Jun 18, 2023 · 27 comments
Open
1 task done

WSLg generates a large number of RdClientAutoTrace files #10216

GZTimeWalker opened this issue Jun 18, 2023 · 27 comments

Comments

@GZTimeWalker
Copy link

GZTimeWalker commented Jun 18, 2023

Windows Version

10.0.x

WSL Version

0.58.3.0 - now

Are you using WSL 1 or WSL 2?

  • WSL 2

Repro Steps

The details can be found at the discussion #8486

we think this should be an issue.

Expected Behavior

do nothing

Actual Behavior

wsl generates a lot of RdClientAutoTrace files that take up so much disk space.

@GZTimeWalker
Copy link
Author

Some potentially relevant elements:

#8544 (comment)
#9752 (comment)

@ariaieboy
Copy link

It's devastating my poor 512GB SSD is full just three days after I removed the files.
Is there any temporary solution for this?

@0x6f677548
Copy link

It's devastating my poor 512GB SSD is full just three days after I removed the files. Is there any temporary solution for this?

my current solution is to have a scheduled task that deletes those files periodically. I am doing it for wsl as well as for some outlook trace files that also have the same behaviour. Script here:
https://github.com/0x6f677548/shell-utils/blob/main/file/Delete-OldFiles.ps1

@haomingz
Copy link

haomingz commented Jun 21, 2023

Temporary solution, turn off support for GUI applications in WSL:

User can also choose to turn off the system distro entirely by adding the following entry in their .wslconfig file (located at c:\users\MyUser\.wslconfig). This will turn off support for GUI applications in WSL.

[wsl2]
guiApplications=false

https://github.com/microsoft/wslg#wslg-system-distro
#8486 (comment)

@ariaieboy
Copy link

Temporary solution, turn off support for GUI applications in WSL:

User can also choose to turn off the system distro entirely by adding the following entry in their .wslconfig file (located at c:\users\MyUser.wslconfig). This will turn off support for GUI applications in WSL.

[wsl2]
guiApplications=false

https://github.com/microsoft/wslg#wslg-system-distro #8486 (comment)

I've added this to my .wslconfig but it didn't help

@pasujemito
Copy link

pasujemito commented Jun 26, 2023

Same issue here, seems like compiled version of RD Client has a bug:

MSRDC_WILFailure : "D:\a\_work\1\s\RdClient\RdClient.SessionHost\exe\msrdc\MSRDCRecoveryManager.cpp",      175, "", "msrdc.exe",    14448,        1,        0, 0x80070002, true
MSRDC_WILFailure : "D:\a\_work\1\s\RdClient\RdClient.SessionHost\exe\msrdc\MSRDCRecoveryManager.cpp",       42, "", "msrdc.exe",    14448,        1,        0, 0x80070002, true
MSRDC_WILFailure : "D:\a\_work\1\s\RdClient\RdClient.SessionHost\exe\msrdc\MSRDCRecoveryManager.cpp",       31, "", "msrdc.exe",    14448,        1,        0, 0x80070002, true

Update: Upon looking into the trace log I found that "EnableMSRDCTelemetry" is missing within registry. I may have fixed the issue by installing Microsoft Remote Desktop MSI (not sure if that works with the AppStore version) followed by system reboot. The error logs for now stopped spamming the RdClientAutoTrace directory.

You can get it here: https://go.microsoft.com/fwlink/?linkid=2068602

@BorkforceOne
Copy link

I discovered I had this issue last night, my 500GB SSD was filled in less than an hour when I walked away from my PC. I tried updating the RD Client as #10216 (comment) mentioned above and that did not fix it for me.

What did fix it for me was adding the following line to .wslconfig as #10216 (comment) mentions.

[wsl2]
guiApplications=false

My WSL version output if it's helpful:

WSL version: 1.3.11.0
Kernel version: 5.15.90.2-3
WSLg version: 1.0.54
MSRDC version: 1.2.4240
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25880.1000-230602-1350.main
Windows version: 10.0.22621.1992

Last time I know it was working was about a week ago if that's helpful.

@hez2010
Copy link

hez2010 commented Jul 21, 2023

I came up with a simple solution that doesn't require disabling guiApplications:

  1. Delete the folder %temp%\DiagOutputDir\RdClientAutoTrace
  2. Create a txt file under %temp%\DiagOutputDir and rename it to RdClientAutoTrace, make sure you have delete the extension name .txt of the file
  3. No RdClientAutoTrace files will be created any more

@tig
Copy link

tig commented Jul 24, 2023

I just had to delete over 100gb of these files.

This needs to be fixed asap.

@hez2010
Copy link

hez2010 commented Jul 24, 2023

Does this method have a side effect ?

No side effects. Those files are all tracing logs.

@influctuation
Copy link

I have the same issue, my disk consumed almost all of the usable space overnight.

@018054646
Copy link

I deleted following option out of my .wslgconfig (%UserProfile%.wslgconfig)
WSL2_WESTON_SHELL_OVERRIDE=desktop-shell

Now it runs perfect.

@matheeshapathirana
Copy link

I came up with a simple solution that doesn't require disabling guiApplications:

1. Delete the folder `%temp%\DiagOutputDir\RdClientAutoTrace`

2. Create a txt file under `%temp%\DiagOutputDir` and rename it to `RdClientAutoTrace`, make sure you have delete the extension name `.txt` of the file

3. No RdClientAutoTrace files will be created any more

Is it ok to do this? im just asking will it corrupt my wsl?

@hez2010
Copy link

hez2010 commented Aug 13, 2023

Is it ok to do this? im just asking will it corrupt my wsl?

It won't. I have used this trick for several weeks and didn't encounter any issue.

@matheeshapathirana
Copy link

Is it ok to do this? im just asking will it corrupt my wsl?

It won't. I have used this trick for several weeks and didn't encounter any issue.

Ok thanks.

@thopiddock
Copy link

I deleted following option out of my .wslgconfig (%UserProfile%.wslgconfig) WSL2_WESTON_SHELL_OVERRIDE=desktop-shell

Now it runs perfect.

I'm wondering what leads this to fix it for you... 🤔

@farzadso
Copy link

farzadso commented Aug 24, 2023

Is it ok to do this? im just asking will it corrupt my wsl?

It won't. I have used this trick for several weeks and didn't encounter any issue.

I tested it. Seems to not have any issues up to now.

@frasermclean
Copy link

Just noticed my system drive was full. Came across this post and deleted 384GB of ETL files!

@oclockvn
Copy link

oclockvn commented Sep 4, 2023

I deny all permissions of SYSTEM user group, seems it's still adding files but just few files
image

@kyesil
Copy link

kyesil commented Oct 12, 2023

That problem fill my disk. and cursor loading blinking.

Fixing temporary:

cmd>wsl --shutdown
cmd>rmdir /s /q "%temp%\DiagOutputDir\RdClientAutoTrace"
cmd>notepad %UserProfile%/.wslconfig

WSL2_WESTON_SHELL_OVERRIDE=desktop-shell
guiApplications=false

@Donovoi
Copy link

Donovoi commented Mar 2, 2024

Hopefully the below can be used in the interim..

Stop-WSLAndCleanRdClientAutoTrace -RepoOwner 'microsoft' -RepoName 'WSL' -IssueNumber 10216
function Stop-WSLAndCleanRdClientAutoTrace {
<#
.SYNOPSIS
Stops all WSL processes and cleans up the RdClientAutoTrace directory if a specific GitHub issue is still open.

.DESCRIPTION
This function checks the status of a specified GitHub issue. If the issue is open, it proceeds to shut down all WSL instances, stop the LxssManager service, delete the RdClientAutoTrace directory, and create a dummy file to prevent future logging. Requires administrative privileges to run.

.PARAMETER RepoOwner
The owner of the GitHub repository.

.PARAMETER RepoName
The name of the GitHub repository.

.PARAMETER IssueNumber
The number of the GitHub issue to check.

.EXAMPLE
Stop-WSLAndCleanRdClientAutoTrace -RepoOwner 'microsoft' -RepoName 'WSL' -IssueNumber 10216

Checks the status of GitHub issue #10216. If open, applies the workaround to stop WSL processes and clean the RdClientAutoTrace directory.
#>
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]$RepoOwner,

        [Parameter(Mandatory = $true)]
        [string]$RepoName,

        [Parameter(Mandatory = $true)]
        [int]$IssueNumber
    )

    # Function to check the status of a GitHub issue
    function Check-GitHubIssueFixed {
        param (
            [string]$RepoOwner,
            [string]$RepoName,
            [int]$IssueNumber
        )

        $issueApiUrl = "https://api.github.com/repos/$RepoOwner/$RepoName/issues/$IssueNumber"

        try {
            $issue = Invoke-RestMethod -Uri $issueApiUrl -Headers @{Accept = 'application/vnd.github.v3+json'}
            return $issue.state -eq 'closed'
        }
        catch {
            Write-Warning "Failed to check GitHub issue status. Error: $_"
            return $false
        }
    }

    # Ensure the function is running with administrative privileges
    if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
        Write-Error "This function requires administrative privileges. Please run PowerShell as an administrator."
        return
    }

    # Check if the GitHub issue is fixed
    $issueFixed = Check-GitHubIssueFixed -RepoOwner $RepoOwner -RepoName $RepoName -IssueNumber $IssueNumber

    if (-not $issueFixed) {
        Write-Host "The GitHub issue is still open. Applying the workaround..."

        # Shutdown all instances of WSL
        wsl --shutdown

        # Stop the LxssManager service
        Get-Service LxssManager | Stop-Service -Force -ErrorAction Stop

        # Define the target directory and file paths
        $tempPath = [System.Environment]::ExpandEnvironmentVariables('%temp%\DiagOutputDir')
        $targetDir = Join-Path -Path $tempPath -ChildPath "RdClientAutoTrace"
        $dummyFile = Join-Path -Path $tempPath -ChildPath "RdClientAutoTrace.txt"

        # Delete the RdClientAutoTrace directory if it exists
        if (Test-Path -Path $targetDir) {
            Remove-Item -Path $targetDir -Recurse -Force -ErrorAction Stop
        }

        # Ensure the DiagOutputDir directory exists
        if (-not (Test-Path -Path $tempPath)) {
            New-Item -ItemType Directory -Path $tempPath | Out-Null
        }

        # Create a dummy RdClientAutoTrace file
        New-Item -ItemType File -Path $dummyFile | Out-Null

        # Rename the dummy file to RdClientAutoTrace (without .txt extension)
        Rename-Item -Path $dummyFile -NewName ($dummyFile -replace '\.txt$','') -ErrorAction Stop

        Write-Host "WSL processes stopped and RdClientAutoTrace directory handled."
    }
    else {
        Write-Host "The GitHub issue has been resolved. No need to apply the workaround."
    }
}

@Genda1ph
Copy link

Just deleted ~100 gigs of this garbage from the last week and applied the workaround. This needs to be fixed.

@kansu4
Copy link

kansu4 commented Aug 2, 2024

I came up with a simple solution that doesn't require disabling guiApplications:

  1. Delete the folder %temp%\DiagOutputDir\RdClientAutoTrace
  2. Create a txt file under %temp%\DiagOutputDir and rename it to RdClientAutoTrace, make sure you have delete the extension name .txt of the file
  3. No RdClientAutoTrace files will be created any more

Didn't work. After I deleted, it creates a new Rd folder and keeps generating the file, do I miss anything?
image

@hez2010
Copy link

hez2010 commented Aug 2, 2024

do I miss anything?
Apparently the extension name is hidden on your system and you didn't remove the extension name from the file you created.

@Genda1ph
Copy link

Bump.

When this is triggered, it wears down SSDs, causes system drive to fill up and WSL to stutter like mad. This is a major regression and it looks like wasn't so much as acknowledged by m$.

@yoinked-h
Copy link

the error that causes the trace file to be created also un-focused me, which is an inconvenience for some fullscreen games that minimize when unfocused; a solution i found was to run a GUI app in the background with explorer closed (maybe not needed?), this no longer caused the random un-focusings and creation of log files

@likemusic
Copy link

Didn't work

You didn't delete .txt file extention, therefore it shown in Explorer with type Text Document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests