microsoft / WSL

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

Add the ability to change the timeout period of a WSL instance #6782

Open hrkrx opened 3 years ago

hrkrx commented 3 years ago

Environment

Windows build number: Microsoft Windows [Version 10.0.21343.1000]
Your Distribution version: Ubuntu 20.04
Whether the issue is on WSL 2 and/or WSL 1: Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020

I have a linux server that provides multiple NFS network drives. As NFS performance under windows is abysmal I use wsl2 to mount the NFS drives.

Steps to reproduce

Mount any NFS drive using wsl.exe as starting point.

That is working well performance wise (which is why i am doing this, as NFS under native windows is abysmal) but the issue is whenever I mount a network drive through wsl2 it gets unmounted rather quickly after a short time of idling.

WSL logs:

Expected behavior

A mounted drive should not be unmounted except the user is specifically unmounting it.

I have solved this issue by adding a watch df -h at the end of the script, but that is in my opinion not the best solution.

Actual behavior

mounted network drives are not accessible anymore after a short time of idling and if you accidentially write to them you add a file to an empty folder which makes a remount impossible without clearing the folder.

craigloewen-msft commented 3 years ago

This issue is caused by the fact that after a period of idle activity, we shut down the WSL 2 VM for you. We do this to help conserve system resources and to make WSL 2 feel lightweight and transparent for users developer scenarios (AKA it starts when you need it to, is fast and shuts down when you're finished with it). WSL 2 instances aren't inherently made to be continuous file servers. I'd say that the best way to log this for the WSL team could be to change this to a feature request to change the timeout parameter for WSL 2, and we can evaluate that feature request in the future. If that seems like a path where your feedback is heard to you, then I can go ahead and do that. Thank you for filing this! :)

hrkrx commented 3 years ago

This issue is caused by the fact that after a period of idle activity, we shut down the WSL 2 VM for you. We do this to help conserve system resources and to make WSL 2 feel lightweight and transparent for users developer scenarios (AKA it starts when you need it to, is fast and shuts down when you're finished with it). WSL 2 instances aren't inherently made to be continuous file servers. I'd say that the best way to log this for the WSL team could be to change this to a feature request to change the timeout parameter for WSL 2, and we can evaluate that feature request in the future. If that seems like a path where your feedback is heard to you, then I can go ahead and do that. Thank you for filing this! :)

I think to being able to set the timeout as parameter for the wsl command would be absolutely acceptable!

craigloewen-msft commented 3 years ago

Got it! I've changed the label of this to a feature and I've edited the title so it will be clear to our team on what this item is tracking. Thank you for the feedback 😁

Biswa96 commented 3 years ago

Doesn't vmIdleTimeout option do the trick? https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-20190

hrkrx commented 3 years ago

Doesn't vmIdleTimeout option do the trick? https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-20190

that handles the timeout for all instances instead of only one doesn't it?

chmely commented 12 months ago

any update on this?

dcharlespyle commented 8 months ago

This is annoying. I used to be able to keep WSL running. I liked having Linux applications at the ready. It was almost bare metal launch speeds. But now I have wait for services to load and the app take several seconds or more before it loads. Used to be two seconds or less. And now DNS doesn't even work anymore when trying to use systemd. Can we have the option to keep Linux running at all times if we have at least 16 GBytes of RAM? I really liked having the ability to run Windows and Linux apps simultaneously at near native speeds. Now I have to wait for everything after the Linux instance times out and shuts down.