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

[BUG] Terminalfont Module Hangs Up WSL Host Machine #1113

Closed
dotaxis opened this issue Jul 22, 2024 · 14 comments
Closed

[BUG] Terminalfont Module Hangs Up WSL Host Machine #1113

dotaxis opened this issue Jul 22, 2024 · 14 comments
Labels
bug Something isn't working can't reproduce WSL Only affects WSL

Comments

@dotaxis
Copy link

dotaxis commented Jul 22, 2024

Be sure to read the FAQ before submitting a new issue.

General description of bug:

  • What happened:
    Very shortly after running fastfetch under Arch on WSL, vmmem memory usage triples, then taskman stops updating and my entire machine becomes unresponsive, forcing me to hard reboot the host machine. Fastfetch does actually run and output seemingly accurate data and over the next several seconds seems to use an abhorrent amount of resources.
  • What should happen:
    Idk, not that though
  • Fastfetch version used:
    happened using both fastfetch and fastfetch-git from the AUR, afraid running fastfetch --version will crash my machine and cause me to rewrite everything in this post, so I will edit it after I'm done submitting
    fastfetch-git: fastfetch 2.19.0-59-debug (x86_64)
    fastfetch: fastfetch 2.19.0 (x86_64)
  • Did it work in an older version:
    Unsure
  • Where did you get the binary:
    AUR / Pacman
  • Does this issue still occur in the latest dev build?
    Yes

Often helpful information:

  • Using defaults that come from the AUR package, no configuration changes.
  • Happens when invoking manually via fastfetch and when run on shell startup.
  • Shell used is fish.
  • Terminal emulator used is Windows Terminal
@dotaxis dotaxis added the bug Something isn't working label Jul 22, 2024
@dotaxis
Copy link
Author

dotaxis commented Jul 22, 2024

It's actually unclear if this is a memory leak or not because htop within WSL doesn't show anything eating memory and vmmem memory usage in taskman does not always go up like I thought it did.

I recorded a short video but had to stop recording before my machine became completely unresponsive.

I also tested using bash and the result is the same.

2024-07-22.15-58-10.mp4

This is extremely bizarre and I'm not sure how to gather useful information about it. A friend running Arch on WSL under Win 11 can't reproduce this, so tomorrow I will see if Ubuntu on WSL causes the same problem.

@CarterLi CarterLi added can't reproduce WSL Only affects WSL labels Jul 23, 2024
@CarterLi
Copy link
Member

It must not be caused by the memory leak of fastfetch because fastfetch has exited normally. Even if fastfetch leaks giga bytes of memory, kernel will recycle it after fastfetch exits.

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

I realize this may be an issue with my machine, but do you have any idea how I might be able to track down exactly wtf is going on here? If I leave firefox running, it remains completely responsive, but discord hangs immediately after running fastfetch, and any attempts at opening new firefox or taskmgr instances are extremely slow as in the video.

I left it for ~15 minutes to see if I'd at least get a BSOD, but the system does not crash and does not return to normal operation either. Half the processes on the host machine just become entirely useless. Even locking the machine took over a minute for the lock screen to come up.

I don't even know where to start debugging it. Perhaps it is just not worth it.

@CarterLi
Copy link
Member

CarterLi commented Jul 23, 2024

Seems that fastfetch trigger an unknown bug of WSL that happens only in your machine. You need to find which module of fastfetch caused that. Please try following instructions

  1. Rename ~/.wslconfig (in Windows) and /etc/wsl.conf (in WSL) to something else. Ignore it if the file doesn't exist
  2. Upgrade to the newest WSL release: https://github.com/microsoft/WSL/releases/tag/2.3.11
  3. Shutdown WSL completely with wsl --shutdown (Run it in Windows)
  4. Run fastfetch in WSL and see if it works.

If it still doesn't work, try following:

  1. Open 2 terminals. One for fastfetch and one for htop. Open task manager too.
  2. Run fastfetch -s GPU --format json and see if it hangs.
  3. Run fastfetch -s TeriminalFont --format json and see if it hangs.
  4. Run fastfetch -s Battery --format json and see if it hangs.

If you find your machine is unstable, you can always force quiting WSL with wsl.exe --shutdown

Screen recording would be much helpful.

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

Updating to the latest WSL did not fix the problem.

The offending module does appear to be terminalfont. Strangely, I was able run all of the modules without a crash and get normal output one time, but I did not save the output of those commands.

This is the output of fastfetch -s terminalfont --format json when it induces a hangup on the host:

 ╭─dot@ArchWSL in ~ took 3ms
[⚡] × fastfetch -s terminalfont --format json
[
  {
    "type": "TerminalFont",
    "error": "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)"
  }
]

Running fastfetch --gen-config and then commenting the "terminalfont" entry allows me to run fastfetch without issue.

I will rename this issue to better match what's actually going on, and if you want to investigate it further I'm happy to help. If not, the terminalfont module is not important to me and I'm fine with the issue being closed.

@dotaxis dotaxis changed the title [BUG] Memory Leak Running Fastfetch Under Arch WSL [BUG] Terminalfont Module Hangs Up WSL Host Machine Jul 23, 2024
@CarterLi
Copy link
Member

Please run this command inside WSL and paste its output

cmd.exe /c 'if exist %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json ( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json ) else if exist %LOCALAPPDATA%\\Packages\\Mi
crosoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json ( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal
Preview_8wekyb3d8bbwe\\LocalState\\settings.json ) else if exist "%LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json" ( ty
pe %LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json ) else ( call )'

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": 
    {
        "defaults": 
        {
            "adjustIndistinguishableColors": "always",
            "backgroundImage": "C:\\Users\\Chase.Taylor\\Pictures\\wp4615535-terminal-wallpapers.jpg",
            "colorScheme": "Tango Dark",
            "experimental.retroTerminalEffect": true
        },
        "list": 
        [
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
                "guid": "{3d759ea4-ffab-4fb5-97c9-e46f414b809b}",
                "hidden": false,
                "icon": "C:\\Program Files\\Git\\git-bash.exe",
                "name": "Git Bash",
                "tabTitle": "Bash"
            },
            {
                "guid": "{a5a97cb8-8961-5535-816d-772efe0c6a3f}",
                "hidden": false,
                "icon": "C:\\Users\\Chase.Taylor\\Pictures\\archlinux-icon-2048x2048-q7549ths.png",
                "name": "Arch",
                "source": "Windows.Terminal.Wsl",
                "suppressApplicationTitle": true,
                "tabTitle": "Arch Linux"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{634c89af-2a9d-5c2c-aa1a-06740f3b1eed}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{89c60468-f661-5387-bff6-2ba7ed866ee8}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": true,
                "name": "Windows PowerShell"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#4F525D",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#073642",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#EEEEEC",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#EEEEEC",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#555753",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#300A24",
            "black": "#171421",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#08458F",
            "brightCyan": "#2C9FB3",
            "brightGreen": "#26A269",
            "brightPurple": "#A347BA",
            "brightRed": "#C01C28",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#A2734C",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#FFFFFF",
            "green": "#26A269",
            "name": "Ubuntu-ColorScheme",
            "purple": "#881798",
            "red": "#C21A23",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#A2734C"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ],
    "themes": []
}

@CarterLi
Copy link
Member

How much time does the command take? Try removing the schemes section in your Windows Terminal JSON config file and try running fastfetch again

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

The command is instantaneous.

Same output here after removing the schemes section from my settings.json and same behaviour from host machine.

 ╰─λ fastfetch -s terminalfont --format json
[
  {
    "type": "TerminalFont",
    "error": "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)"
  }
]

This command takes a couple of seconds, not sure exactly how long.

@CarterLi
Copy link
Member

Please try fastfetch -s terminalfont --format json --processing-timeout 10000 --stat

@CarterLi
Copy link
Member

CarterLi commented Jul 23, 2024

What if you clear the content of your terminal config file? Be sure to backup it

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

╰─λ fastfetch -s terminalfont --format json --processing-timeout 10000 --stat
[
  {
    "type": "TerminalFont",
    "error": "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)",
    "stat": 10014
  }
]

Will try clearing config after a reboot

@dotaxis
Copy link
Author

dotaxis commented Jul 23, 2024

Same issue after clearing config.

@CarterLi
Copy link
Member

I don't know what happened in your machine. I just removed terminal font detection support for Windows Terminal in WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working can't reproduce WSL Only affects WSL
Projects
None yet
Development

No branches or pull requests

2 participants