microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.51k stars 822 forks source link

Windows Defender is fcking the performance of Windows 11 WSL2 #8995

Open gochev opened 2 years ago

gochev commented 2 years ago

Version

Windows 11 22H2

WSL Version

Kernel Version

No response

Distro Version

all

Other Software

No response

Repro Steps

turn off windows defender real protection check any app using wsl2 network drive for indexing or reading. Turn on windows Defender real protection Try again.

Expected Behavior

Windows Defender should NOT make WSL2 useless for IntelliJ IDEA , PhpStork , Raider IDE etc.

Actual Behavior

the reindexing stuck on all not Microsoft owned IDEs

Diagnostic Logs

I know Microsoft wants people to use VScode but this is just Ugly and super bad practice.

To force people to use stupid editor because Windows Defender is making other IDEs useless in WSL2 is just a dick move.

gochev commented 2 years ago

This was not an issue in Windows 10 before upgrade. Also it looks Windows Defender is completely ignoring the excluded folders , since this doesn't helped in any way.Only complete turn off of the Windows Defender Virus is the solution.

gaborauth commented 2 years ago

Oh, my whole day went to waste because I couldn't work with IntelliJ IDEA... I tried everything, reboot, reinstall, configure WSL2, etc, then I ended up with this issue... :/

Yes, W11, 22H2, first cumulative update.

bahag-xvisnei commented 2 years ago

Dear WSL Team, please fix this asap

Holy87 commented 2 years ago

Same problem here, Gradle project on WSL2 with IntelliJ. This wasn't an issue before the upgrade to Windows 11.

sefaYavuz commented 2 years ago

Same problem here. Wasted like an entire week only to find out about this. Disabling realtime protection fixes it instantly with IntelliJ.

ArjanShoj commented 2 years ago

I had the same issue. This wasn't a problem on Windows 10. This occurred when I upgraded to Windows 11. By disabling Windows Defender it fixes the issue, but that shouldn't be a proper workaround, since my workstation is vulnerable now!

lyleschemmerling commented 2 years ago

I have the exact same problem, and can confirm turning off Defender takes care of it, but really don't consider that a solution. Logs before disabling defender:

`2022-11-12 19:52:44,447 [ 464502] INFO - #c.i.w.f.WslFsdServer - fsd standard output received: C:\WINDOWS\system32\wsl.exe [--distribution, Ubuntu-22.04, --exec, /bin/sh, -c, export RUST_LOG=info && cd /windows/c/myuser/AppData/Local/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/plugins/wsl-fs-helper/bin && ./server --port 52444 --instance WSL-Ubuntu-22.04 --logs-path /windows/c/myuser/AppData/Local/JetBrains/IntelliJIdea2022.2/log/fsd]

2022-11-12 19:52:44,448 [ 464503] INFO - #c.i.w.f.WslFsdServer - WSL fsd server started for Ubuntu-22.04 at port 52444 2022-11-12 19:52:44,448 [ 464503] INFO - #f.r.c.Socket - Connecting to ws://localhost:52444 2022-11-12 19:52:44,460 [ 464515] INFO - #c.i.w.f.WslContentLoader - Connection is not available. Current rpc strategy opted out waiting for reconnect. fleet.rpc.client.RpcClientDisconnectedException: Connection is not available. Current rpc strategy opted out waiting for reconnect. at fleet.rpc.client.IRpcClientKt$reconnectingRpcClient$1$call$2.invokeSuspend(IRpcClient.kt:105) at fleet.rpc.client.IRpcClientKt$reconnectingRpcClient$1$call$2.invoke(IRpcClient.kt) at fleet.rpc.client.IRpcClientKt$reconnectingRpcClient$1$call$2.invoke(IRpcClient.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100) 2022-11-12 19:52:44,823 [ 464878] INFO - #c.i.w.f.WslContentLoader - Permission denied (os error 13), path: /dev/kvm java.io.IOException: Permission denied (os error 13), path: /dev/kvm at fleet.api.FsApiKt.ioException(FsApi.kt:429) at fleet.api.FsApiKt.unwrap(FsApi.kt:421) at com.intellij.wsl.fs.WslContentLoader$getInputStream$inputStream$1$1$1.invokeSuspend(WslContentLoader.kt:47)`

Nastase commented 2 years ago

+1

Same issue here. After upgrading to Windows 11, the whole JetBrains toolset is unusable for projects stored in WSL2. This is highly annoying as I simply cannot work in that setup.

For obvious reasons, disabling Windows Defender is not a solution.

dorianmihu commented 2 years ago

+1 Btw, until this is solved, if you don't want do disable Windows Defender, the only other acceptable workaround I know of, for using IntelliJ, is to install it directly within your WSL. Windows11 now supports running GUI apps from within WSL so this should still work

andruwa01 commented 2 years ago

+1 the same problem. Works only if you disable real time protection...

baiyz0825 commented 2 years ago

+1 i have the same problem,when i using win11 and ubuntu22.04(wsl).the idea(2022.2.3) will frezen when indexing and scaning maven dependences . and i tried to close windows defender anti virus , that don't work for me . i hope this can be fix soon. in the https://youtrack.jetbrains.com/issue/IDEA-286059/IDE-freezes-and-hangs-2021.3.1-on-indexing-of-WSL-project same most of user have same problem. image

gaborauth commented 2 years ago

Slow but good workaround: let the IntelliJ IDEA to update indexes, it takes a day or more. :/

baiyz0825 commented 2 years ago

缓慢但很好的解决方法:让 IntelliJ IDEA 更新索引,这需要一天或更长时间。:/

you mean i spend some times to let the idea to update index , but when i create a new project , Whether it can be relieved ?or still have this problem.

gaborauth commented 2 years ago

you mean i spend some times to let the idea to update index , but when i create a new project , Whether it can be relieved ?or still have this problem.

Yes, it's my workaround, fortunately I have old projects, so I let the IntelliJ IDEA to update the indexes and now it works. If you need a lot of new project, it is not a good workaround.

baiyz0825 commented 2 years ago

you mean i spend some times to let the idea to update index , but when i create a new project , Whether it can be relieved ?or still have this problem.

Yes, it's my workaround, fortunately I have old projects, so I let the IntelliJ IDEA to update the indexes and now it works. If you need a lot of new project, it is not a good workaround.

ok,i know thank,hope wsl team can fix this

gaborauth commented 2 years ago

ok,i know thank, hope wsl team can fix this

I hope too...

no-ivan commented 1 year ago

+1. Still performing real-time disabling

Nastase commented 1 year ago

Two months later and still no solution, neither from Microsoft nor Jetbrains. Seems they don't give two f**ks about their customers.

ivanielin commented 1 year ago

This is just vastly unacceptable - some reaction at least?

SugarSpike commented 1 year ago

The worst part is after the last Windows update (like 2-3 days ago) this same problem is also present on Windows 10?

habnux commented 1 year ago

Really bad experience in Windows 10 (19045.2364) as well.

no-ivan commented 1 year ago

image

habnux commented 1 year ago

If feel sometimes like Asterix... https://www.youtube.com/watch?v=ZHRGjfEQpy4

joerosen commented 1 year ago

FYI, on my machine I was able to fix this (with realtime protection enabled) by adding two exclusions to Windows Defender:

process: fsnotifier-wsl process: idea64.exe

Running:

Windows 10 22H2 (19045.2364) IntelliJ 2022.3 (community) WSL version: 1.0.3.0

Nastase commented 1 year ago

Thanks for the tip. However, the exclusions work on Windows 10, not on Windows 11...

adamwojszczyk commented 1 year ago

@Nastase It works on win11. I tested that.

Nastase commented 1 year ago

It improves things but still get stuck on scanning index for maven dependencies

joerosen commented 1 year ago

@Nastase It took me a little while to get the right combo to exclude. Maybe yours is slightly different? Perhaps try a wildcard process exclusion on the entire intellij 'bin' directory?

https://support.microsoft.com/en-us/topic/how-to-add-a-file-type-or-process-exclusion-to-windows-security-e524cbc2-3975-63c2-f9d1-7c2eb5331e53

andrewmmg commented 1 year ago

Same here. The issue appeared after updating my WSL2 on Windows 10. Have spent a lot of time figuring this out until I found the solution proposed by @joerosen. Excluding those 2 processes did the trick.

For those who still experience some slowness in IDEA while indexing even after that fix - you might want to try disabling wsl.fsd.content.loader in the IDEA (Shift-Shift -> Experimental Features -> Untick the Enabled checkbox next to the feature)

Nastase commented 1 year ago

Found another "solution" on another thread (thanks to the author): install a different antivirus. I installed the free version of Avast and all problems solved.

vedrancu commented 1 year ago

@joerosen

FYI, on my machine I was able to fix this (with realtime protection enabled) by adding two exclusions to Windows Defender:

process: fsnotifier-wsl process: idea64.exe

Running:

Windows 10 22H2 (19045.2364) IntelliJ 2022.3 (community) WSL version: 1.0.3.0

Thanks you a lot. After two day of strangling I found your solution. You saved me.

What is strange is that issue started about 10 days ago, before It worked fine for me (I run on Win 10). Did windows defender make some changes recently?

gochev commented 1 year ago

Windows defender used to be a good app it's not anymore. Installing any other antivirus like avast fixes the issue

eekboom commented 1 year ago

I have the same (or a similar?) problem, even though using Sophos anti virus instead of Windows Defender.

Is there a way to downgrade back from the Microsoft Store version of WSL to the Windows WSL version?

ivanielin commented 1 year ago

Well, Avast Free Antivirus did the trick for me but this is is Just a workaround. And still no answer here ? this WSL support in 2023 is not encouraging to say the least...

lukasamd commented 1 year ago

I use 22H2 with WSL2 (Ubuntu 20.04) and phpstorm - no issues Added some directories (docker, phpstorm, wsl, etc.) and processes (phpstorm, wsl) into exclusions, maybe it's a bit faster... Not sure.

It's faster if I use remote development on phpstorm or just use native linux instead of WSL, but it is not huge difference Project is quite big and do not see indexing issues

You can also try disable interop in /etc/wsl.conf https://learn.microsoft.com/en-us/windows/wsl/wsl-config#interop-settings

vedrancu commented 1 year ago

My problem was not in WSL2 but in Windows Defender. After did exclusions as describe above, IDEA loads project quickly.

lukasamd commented 1 year ago

I also use Windows Defender - looks like it does not scan items inside WSL2 (tried to download eicar file - no reaction from Defender), but it can hits communication between host and linux distro. JetBrain's IDEs use a lot of communication in normal mode, different one is remote development or run it natively using WSLg, maybe it's the reason?

GSuaki commented 1 year ago

Plus one to Windows Defender problem! Fixed with exclusions.

bademux commented 1 year ago

Unfortunately Windows is not intended to be used by humans. It is the system for updating, installing antiviruses and monitoring tools to have Sec team busy.

upd: updated OS to linux to fix performance\UX problems

lethunder commented 1 year ago

Guys i excluded it from bitdefender and kaspersky but still not working. It's just too slow image

I'm on windows 11 with rubymine 2022.3.1

dbalabka commented 1 year ago

I've added the following Windows Defender exclusion to fix IDEA performance issues: Folders:

  1. C:\Users\<username>\AppData\Local\JetBrains
  2. C:\Programm Files\Docker
  3. \\wsl$\Ubuntu\home\user\src
  4. \\wsl.localhost\Ubuntu\home\user\src

File types:

  1. vhd
  2. vhdx

Processes:

  1. phpstorm64.exe
  2. pycharm64.exe
  3. dataspell64.exe
  4. fsnotifier.exe
  5. jcef_helper.exe
  6. jetbrains-toolbox.exe
  7. docker.exe
  8. com.docker.*.*
  9. Desktop Docker.exe
  10. wsl.exe
  11. wslhost.exe
  12. vmmemWSL

UPDATE: added WSL folders:

  1. \\wsl$\Ubuntu\home\user\src
  2. \\wsl.localhost\Ubuntu\home\user\src
fikani commented 1 year ago

I added the following Windows Defender exclusion to fix IDEA performance issues: Folders:

  1. C:\Users\<username>\AppData\Local\JetBrains
  2. C:\Programm Files\Docker

File types:

  1. vhd
  2. vhdx

Processes:

  1. phpstorm64.exe
  2. pycharm64.exe
  3. dataspell64.exe
  4. fsnotifier.exe
  5. jcef_helper.exe
  6. jetbrains-toolbox.exe
  7. docker.exe
  8. com.docker.*.*
  9. Desktop Docker.exe
  10. wsl.exe
  11. wslhost.exe
  12. vmmemWSL

Exclusively for intellij (my case) this worked.

I added the following Windows Defender exclusion to fix IDEA performance issues:

Folders: C:\Users\\AppData\Local\JetBrains

Processes: idea64.exe

For PhpStorm I didnt need to do anything.

joferrao commented 1 year ago

Anyone else without an visibly active Antivirus with the same issue?

lethunder commented 1 year ago

It does the same thing if i disable bit defender and kaspersky. It keeps being slow

lukasamd commented 1 year ago

@lethunder It's normal - if you will disable 3party AV, defender will be activated, even in passive mode

lethunder commented 1 year ago

Thanks @lukasamd . Good to know. This issue makes my life much more difficult.

dbalabka commented 1 year ago

I've excluded WSL folders as well. See the above comment https://github.com/microsoft/WSL/issues/8995#issuecomment-1380187901

lethunder commented 1 year ago

for those using HP computer it was link to ironwolf. I disable it and it works

Rattone commented 1 year ago

for those using HP computer it was link to ironwolf. I disable it and it works

can you please be more clear? which link?

lethunder commented 1 year ago

i have a HP Zbook. It comes by defaut with a software install HP Wolf Security. It was responsible for rubymine's slowness. As soon as i uninstall it everything went back