bostrot / wsl2-distro-manager

A GUI to quickly manage your WSL2 instances
https://apps.microsoft.com/store/detail/wsl-manager/9NWS9K95NMJB
Other
1.93k stars 115 forks source link

[BUG] High cpu consumption when downloading a distro #116

Closed Felipe-Linhares closed 1 year ago

Felipe-Linhares commented 1 year ago

Is there an existing issue for this?

Current Behavior

notice that the video stopped. https://user-images.githubusercontent.com/70000056/226991348-b9a0d6d5-5529-4cd1-bb0d-d7d539e058d6.mp4

Expected Behavior

download the distro without crashing the machine

Steps To Reproduce

  1. open wsl manager.
  2. I went to add an instance.
  3. I put the name.
  4. I selected the distro I wanted.
  5. I went to create.

Environment

- Windows Version: Windows 11 Pro 22H2 (22621.14.13)
- WSL Distro Manager Version: 1.6.1
- WSL Version: 1.1.3.0
- Source: Windows Store

Anything else?

No response

github-actions[bot] commented 1 year ago

Hello there! As you are a first time Issuer please read our Code of Conduct. Please also check whether your issue description is reasonable and complete. If you are having an issue always include the version you are using (WSL, this app, Windows) as well as a way to reproduce it.

bostrot commented 1 year ago

Could you share your hardware specs?

Felipe-Linhares commented 1 year ago
bostrot commented 1 year ago

Hmm, that shouldn't be a problem.. Could you try restarting your pc, maybe ending background processes, and check if it is still that slow for you?

Felipe-Linhares commented 1 year ago

I did that, but even so, the high CPU consumption and the crash continued, I bought the version from the microsoft store, but it is outdated, it is at 1.6.0 :c

bostrot commented 1 year ago

That is a bug. That version shows 1.6.0 but in fact is 1.6.1. I will fix that very soon :)

Can you also tell me what your Internet bandwidth is? (trying to find a way to reproduce your issue)

Felipe-Linhares commented 1 year ago

Aaaaa, got it, my internet is 600Mb.

bostrot commented 1 year ago

Does this also happen whem you select other distros? E.g. Ubuntu 22.04?

Felipe-Linhares commented 1 year ago

it happens, I tested it with some Ubuntu available, and also Debian

bostrot commented 1 year ago

Can you try either version v1.6.0 (from the releases page) or the build here (build/windows/runner/release) v1.5.0?

Sorry, to make you do all this but I can't reproduce it :/

Felipe-Linhares commented 1 year ago

Okay, I just tested it in version 1.5.0 and 1.6.0, and the same error happens, it crashes the machine

bostrot commented 1 year ago

So the WSL2 Manager process makes the usage go to 100% or is it some other process (invoked by wsl manager maybe)? I am not seeing it in the process list.

Felipe-Linhares commented 1 year ago

It doesn't appear because the task manager hangs, everything hangs in fact, then I can't identify the process that is increasing the CPU usage

bostrot commented 1 year ago

I see.

Does it also happen when you manually import a rootfs with wsl (without WSL Manager)?

e.g. with Ubuntu 20.04 rootfs: wsl --import testimport C:\WSL2-Distros ~\Downloads\ubuntu-20.04-server-cloudimg-amd64-wsl.rootfs.tar.gz

Felipe-Linhares commented 1 year ago

everything went well, it didn't crash the system

bostrot commented 1 year ago

Not sure what is going wrong there then..

I saw that you checked out the source. Can you try to debug it and check somewhere along these lines where exactly it happens: https://github.com/bostrot/wsl2-distro-manager/blob/main/lib/dialogs/create_dialog.dart#L172

I suspect it might have something to do with the SharedPreferences as the only other thing there is probably the call to the import command and that should work as expected.

Felipe-Linhares commented 1 year ago

I'm going to debug here, if I get something that can help, I'll come back here, thanks for the answer

bostrot commented 1 year ago

Sure, tell me when you find something. I am curious.

Also just for references: the cpu usage on my machine is under 1% for this app when creating a distro.

Felipe-Linhares commented 1 year ago

is your machine AMD?

bostrot commented 1 year ago

I tried both on Intel and AMD machines.

bostrot commented 1 year ago

Just thought about something else: have you tried to disable any antivirus you have?

Felipe-Linhares commented 1 year ago

I hadn't thought of that, I'll try it here

Felipe-Linhares commented 1 year ago

I tried here but got the same result :C

bostrot commented 1 year ago

Do you have a second machine to test it on? Also any luck with debugging?

Felipe-Linhares commented 1 year ago

No, but I'll talk to a friend to test it, I had no luck with the debug, but I'm looking

Felipe-Linhares commented 1 year ago

managed to capture the WSL Manager process image

bostrot commented 1 year ago

I had hoped that would help more :/

Could try to use the windows diagnose start and see if that changes anything? (win+r then msconfig the second option)

image

Felipe-Linhares commented 1 year ago

i tried but without success

lesmo commented 1 year ago

I'm finding this issue too on a Microsoft Surface Studio laptop with i7 11th gen and 32gb of RAM. The process didn't crash, but it slowed the entire PC down horribly.

I also have a Razer Blade 2019 (i7 8th gen, 64gb of RAM) I can test on, but that'll have to wait a bit cuz' I'm out of town for the week.

bostrot commented 1 year ago

@lesmo Do you have, by any chance, windows Ransomware protection on?

Also could you too check the task manager and see what process exactly is ramping up?

I guess you are on version 1.7.1?

EDIT: I will create a build with extra logging later. Maybe you can run that and hopefully it will tell us what is going wrong.

bostrot commented 1 year ago

Is this fixed with v1.7.4?

bostrot commented 1 year ago

Closing for now. Reopen if you still encounter this issue.