Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh processes under tmux accumulate, eating CPU #3914

Closed
xTEddie opened this issue Mar 13, 2019 · 14 comments
Closed

zsh processes under tmux accumulate, eating CPU #3914

xTEddie opened this issue Mar 13, 2019 · 14 comments
Labels

Comments

@xTEddie
Copy link

xTEddie commented Mar 13, 2019

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.17763.379]

  • What you're doing and what's happening:
    I have zsh as my default shell and I use WSL for web development. I have a shell script to run a tmux session with 5 window panes to set up my web dev environment. I close everything on WSL once I'm done with my web development project for the day. I noticed sometimes my computer lags for some reason then I found out a lot of zsh processes were still running on Window Task Manager even though WSL is closed.

  • What's wrong / what should be happening instead:
    All processes running on WSL should be terminated as soon as I close WSL.

@benhillis
Copy link
Member

benhillis commented Mar 13, 2019

This is likely due to daemon support. We do not terminate instances until the last daemon process goes away. If you'd like to forcibly terminate your distribution, you can use wslconfig.exe /t distroname.

@xTEddie
Copy link
Author

xTEddie commented Mar 21, 2019

I've been monitoring the processes on task manager. It seems that there's a new process of zsh that's created for every commands I run on a tmux pane. Sometimes I see 10+ processes of zsh running and it eats the CPU. I had to kill a a couple of zsh processes to release the load on the CPU. Is this normal?

@therealkenc
Copy link
Collaborator

therealkenc commented Mar 22, 2019

There were two asks in this issue which caused it to go dark. First was terminating the tmux service on the last exit, the behavior of which changed in 17046. That much by-design. The other was "I noticed sometimes my computer lags" which might be a lot like #3503 (or might not). #3503 for its part petered into a discussion thread, and never got closed with any kind of concrete by-design explanation.

Fixing up the title just so there is a landing zone for dupes. I suspect but can't prove that the reason these processes accumulate is going to be arcane, undesirable, but correct. It would take a dive from someone to figure out what exactly is going on here. One thing worth investigating would be why it is eating CPU (as opposed to just RAM). Even if the processes accumulate, they either (a) shouldn't spin or (b) are spinning for a good reason under WSL's model that isn't explained. I can't say which.

@therealkenc therealkenc changed the title WSL processes not terminated on closing of WSL zsh processes under tmux accumulate, eating CPU Mar 22, 2019
@xTEddie
Copy link
Author

xTEddie commented Mar 22, 2019

I am doing web development using Django (python webserver) and React (using webpack-dev-server). Not sure if this will be helpful for the investigation.

@Po-wei
Copy link

Po-wei commented Mar 25, 2019

@xTEddie
"All processes running on WSL should be terminated as soon as I close WSL." This is NOT correct.
Just like @therealkenc said, after 17046, WSL allow background process (e.g. ssh-server, tmux, etc)
So if you just close the windows, these process will not close by design.

@therealkenc
Copy link
Collaborator

Can folks experiencing the "I noticed sometimes my computer lags for some reason" part of the OP give Insider 18362 (or better) a try to see if the problem is variation #3940 aka #3741. Maybe we'll get lucky.

@jmccormac01
Copy link

jmccormac01 commented Sep 5, 2019

Same issue here. I fired up a few panes in tmux and without doing anything my CPU is being hammered. There is nothing running in the panes.

I closed a few panes as the CPU was under 100% load and the prompt was not even loading in the final panes when aranging my layout. I have 6 panes left open and 11 zsh processes still running in task manager

screenshot_000219

screenshot_000218

@nicholasRenninger
Copy link

I have a similar issue when using WSL with the Ubuntu 18.04 LTS distro, zsh, and the new windows terminal. When closing out of shell instances, the zsh process persists and starts spinning up. After using the new windows terminal for a little while (opening and closing new terminal tabs), I have to manually go kill all these zsh processes.

@dakiri
Copy link

dakiri commented Jan 12, 2020

Same as @nicholasRenninger on my WSL with Ubuntu 18.04, 100% CPU with zsh, have to killed them with process manager.
It seems that Zsh is not killed when I close my terminal.

@FG-avi
Copy link

FG-avi commented Jan 23, 2020

I am having the same problem. I closed all my WSL Ubuntu windows and I still have a bunch of zsh processes running. One process for some reason has high CPU utilization.
I also have a TMUX service running and I understand why that stays on since TMUX is supposed to be a server. I don't understand why zsh does not get closed.

@therealkenc
Copy link
Collaborator

I don't understand why zsh does not get closed.

There were two asks in this issue which caused it to go dark. First was terminating the tmux service on the last exit, the behavior of which changed in 17046. That much by-design.

@DjampaKozlowski
Copy link

Hello,

It seems I experienced a similar issue with bash (unkillable bash and init process eating CPU until hard reset). I solved it enabling windows 10 virtual machine platform (tutorial) as advised in this post.

It seems to work like a charm now.

Cheers,
D

@JoshBlades
Copy link

Hi,

Just had this issue. Multiple processes open, two running at 16% CPU each.

Running WSL Ubuntu (18.04.4), with Zsh within tmux sessions.

Windows 10, build version: 18363.959

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants