Is anyone else experiencing an issue where #PHPStorm takes 30-60sec to save files when working in a #WSL (wsl2/windows 10) project?

This issue seems to have started for me after a Windows update last week.

I have Storm installed on Windows. Tried installing Storm also directly on WSL (Ubuntu) and that seems to work for saving, but because of other things makes XDebug inaccessible. (โ•ฏโ€™โ–กโ€™)โ•ฏ๏ธต โ”ปโ”โ”ป

@iCaspar You can make Xdebug work there, I believe by setting xdebug.client_host=localhost โ€” if that doesn't work, try xdebug://nameserver โ€” and if that doesn't work, make a log (xdebug.log_level=11 + xdebug.log=/tmp/xdebug.log) and show it to me ๐Ÿ™‚

@derickr Thanks for this.

I'll give that a go.

The project is actually running inside a highly customized #Lando (wrapper for #docker) container running inside #wsl

There is some info about it here: https://docs.lando.dev/guides/setup-lando-on-windows-with-wsl-2.html#configure-host-ip
But our lando things are customized to the point where this does not work "out of the box".

(With Storm running on the Windows side, using host.docker.internal:host-gateway under extra_hosts in the .lando.yml works fine.)

Setup Lando on Windows with WSL2

Configure Lando to run on your Windows WSL2 system for better performance when developing on Windows.

Lando

@iCaspar You don't have to add that line anymore with Xdebug 3.2 either - you can set:

xdebug.client_host=xdebug://gateway

@iCaspar Do you have Windows Defender enabled Caspar?

I reported an issue in a 2021.x release moons ago now which Jetbrains resolved, but there's still endless people complaining in the same ticket of the issue. There's been updates to that to say that the problem lies with Windows Defender now (I use ESET NOD32 which explains why I don't continue to see the issues after initial resolution).

As you mention a Windows update, it certainly may be related.

Maybe useful? https://youtrack.jetbrains.com/issue/IDEA-286059/IDE-freezes-and-hangs-2021.3.1-on-indexing-of-WSL-project

@ianh
Yes, I feel certain that Windows Defender is in play, as well as a lot of other company-specific "security" packages and "big-brother-ware" the company insists on. :(

In spite of the Defender issue, this had been working fine until last week, making the latest Windows update the suspected culprit.

@iCaspar The comment https://youtrack.jetbrains.com/issue/IDEA-286059/IDE-freezes-and-hangs-2021.3.1-on-indexing-of-WSL-project#focus=Comments-27-6533612.0-0 gives a few ideas for adding dir exclusions to Defender, which might help? (I'm assuming these help due to indexes and caches seeing as they're actually Windows (rather than WSL) paths.

I do all my dev work in Docker within WSL2 and haven't noticed any issues like this since JB resolved the problem (in my case).

Sounds like you don't have the luxury even temporarily disabling Defender to test this scenario?

@ianh Indeed. They have all that stuff locked down.

@iCaspar

not exactly the same, but I run phpstorm on windows, w. source code code in a linux vm, exporting it to windows via samba.
After the latest PS update, I tweaked windows defender setting as recommended by the IDE.
Not sure if it was that change, the IDE update or a window update, but now it takes 1-2 minutes to scan for modified files on each startup instead of being faster...

@gggeek Another person on our team opened a ticket on YouTrack. So far the response has been to try the Windows Defender exclusions. Unfortunately our company machines are totally locked down by our infosec ppl, and that route is not available to us. Another person on our team who had indexing slowness updated wsl to the pre-release version. That fixed the indexing problem but not the slow file saving issue.