fastfetch-cli / fastfetch

An actively maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
10.07k stars 399 forks source link

[BUG] fastfetch on Windows hangs for a long time when calculating the drive size. On WSL, it is instant. #819

Closed RioNight closed 5 months ago

RioNight commented 5 months ago

General description of bug:

Often helpful information:

Screenshot: It hangs here for a while: image

The content of the configuration file you use (if any): (none)

Output of fastfetch -c ci.jsonc --format json:

//paste here

Output of fastfetch --list-features:

threads
vulkan
zlib
opencl
Proprietary GPU driver API

If fastfatch crashed or freezed

Paste the stacktrace here. You may get it with:

# You may need Ctrl+C to stop the process if it freezes
gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch

If you are able to identify which module crashed, the strace can be helpful too

strace /path/to/fastfetch --multithreading false -s {MODULE} --pipe

If you cannot do the instructions above, please upload the core dump file:

If my image logo didn't show / work

If fastfetch behaves incorrectly on shell starting

RioNight commented 5 months ago

I observe this on several Windows machines.

CarterLi commented 5 months ago

Do you have some USB flash drives or portable hard drives plugged in? If yes, plug them out and try again.

CarterLi commented 5 months ago

What does fastfetch -s physicaldisk print?

CarterLi commented 5 months ago

Does diskmgmt.msc hang too?

RioNight commented 5 months ago

To clarify, "a long time" means about 7 seconds. diskmgmt.msc runs but is a bit slow. It does not show network drives. fastfetch -s physicaldisk is instant, but it does not show network drives. WSL doesn't show these network drives as well.

Maybe that's what's causing the hold up. Is there a way to speed this up or leave network drives out of the fastfetch output?

fastfetch -s physicaldisk output:

Physical Disk (HGST HTS721010A9E630): 931.51 GiB [HDD, Fixed]
Physical Disk (Msft Virtual Disk): 8.00 GiB [SSD, Fixed]
Physical Disk (SAMSUNG MZVLW512HMJP-000H1): 476.94 GiB [SSD, Fixed]
CarterLi commented 5 months ago

https://github.com/fastfetch-cli/fastfetch/actions/runs/8881325802/artifacts/1457223656

Try this one with --disk-ignore-remote

RioNight commented 5 months ago

Thanks, this flag works and fastfetch completes instantly. Currently, the default fastfetch takes longer to run than the other default *fetch programs (like winfetch) if there is a network drive. Would you consider setting this to true by default on Windows? Or if there is some other solution to make the default fastfetch run fast on Windows...

CarterLi commented 5 months ago

Currently, the default fastfetch takes longer to run than the other default *fetch programs (like winfetch) if there is a network drive.

It's because winfetch only detects C: by default. If you set $ShowDisks = @("*") winfetch hangs too.

Would you consider setting this to true by default on Windows? Or if there is some other solution to make the default fastfetch run fast on Windows...

No. Network drives are commonly used in VM which match paths in host machine. Accessing them won't block. I don't think many people really mapping network location to local drives.

CarterLi commented 5 months ago

I decided removing --disk-ignore-remote. Instead, use --disk-folders to set which folders you want to detect, which matches behavior of @ShowDisks in winfetch. Default to all unlike winfetch, however.

See fastfetch -h disk-folders for detail

RioNight commented 5 months ago

If you wanted to test network drives without an extra computer, you could connect a USB stick to you router. That is how mine is set up.

ykhan21 commented 5 months ago

@CarterLi, I had a similar issue. The network drives appeared to hang fastfetch for 10 seconds. I had two network drives, one connected and one disconnected. Once I told Windows File Explorer to "forget" only the disconnected network drive, it ran fast. It seems like there is a large timeout on getting the network drive information.

CarterLi commented 5 months ago

@ykhan21 Just use --disk-folders C:\

CarterLi commented 5 months ago

It seems like there is a large timeout on getting the network drive information

Windows kernel desides the timeout, and provides no configuration for fastfetch to control it.

CarterLi commented 5 months ago

I investigated it a little bit more. It seems that using sub-threads is the only option ( IO operations stuck at CreateFileW ).

Did a quick fix. Please have a test: https://github.com/fastfetch-cli/fastfetch/actions/runs/8948869450/artifacts/1472816825

ykhan21 commented 5 months ago

I tried the latest release. It works now. Thanks.