asdf-vm / asdf-erlang

Erlang plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
482 stars 119 forks source link

High cpu usage #99

Closed khipukamayuq closed 5 years ago

khipukamayuq commented 5 years ago

Been running into lots of system freezing out of nowhere just today. On Ubuntu 18.10. I've had asdf and associated erlang/elixir on this device for just a few weeks, though my previous work device ran those for 6 mos+ without issue.

top at the CLI resulted in:

MiB Mem :  15891.7 total,  10012.2 free,   5480.0 used,    399.6 buff/cache
MiB Swap:   2048.0 total,      0.1 free,   2047.9 used.  10065.1 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND   
24742 me  20   0 3064416  26640      0 S 100.7   0.2 110:40.49 beam.smp  
10832 me  20   0 3062368  24352      0 S 100.3   0.1 121:11.09 beam.smp  
19459 me  20   0 3054432  18884    436 S 100.0   0.1   7:56.22 beam.smp  
24044 me  20   0 3056992      0      0 S 100.0   0.0 132:54.63 beam.smp  
26501 me  20   0 3056992  21664      0 S 100.0   0.1  85:08.98 beam.smp  
24032 me  20   0  803648 168028  78008 S   2.7   1.0   0:11.31 chrome    
 4103 me  20   0 1467872 212296  39792 S   2.3   1.3   5:49.29 chrome    
 5589 me  20   0  710392  64472  21044 S   2.3   0.4   3:07.66 chrome    
 5767 me  20   0 1276576 430808  48524 S   2.0   2.6   1:07.65 chrome    
 4171 me  20   0  572248 109052  27540 S   1.7   0.7   4:24.99 chrome    
 5622 me  20   0  668960  32404  11480 S   1.7   0.2   3:01.49 chrome    
24140 me  20   0  693060  63020  16268 S   1.7   0.4   0:05.65 chrome    
 3703 me  20   0 1536544 141196  29668 S   1.0   0.9   0:33.60 slack     
25360 me  20   0   34880   3700   3012 R   0.7   0.0   0:00.07 top 

Did ps x | grep bea[m] and results all pointed to asdf/erlang:

 4034 ?        Sl     8:16 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
 6536 ?        Sl    11:11 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
 7399 ?        Sl     7:28 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
 8342 ?        Sl     8:31 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
 9780 ?        Sl     9:18 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
10832 ?        Sl   129:17 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
19459 ?        Sl    16:01 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
24044 ?        Sl   141:00 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
24742 ?        Sl   118:46 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
26501 ?        Sl    93:14 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
26809 ?        Sl    11:59 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
32023 ?        Sl     8:34 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo
32160 ?        Sl    11:38 ~/.asdf/installs/erlang/21.3/erts-10.3/bin/beam.smp -- -root ~/.asdf/installs/erlang/21.3 -progname erl -- -home ~/ -- -pa ~/.asdf/installs/elixir/1.8.1/bin/../lib/eex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/elixir/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/ex_unit/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/iex/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/logger/ebin ~/.asdf/installs/elixir/1.8.1/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra ~/.asdf/shims/mix help credo

I'm not sure how all these came to be. I can kill these by pid, of course, but how do I prevent all these instances from persisting? Thanks.

Stratus3D commented 5 years ago

What version of asdf are you using? And how to you typically stop the Erlang shell or other Erlang processes?

khipukamayuq commented 5 years ago

@Stratus3D Apologies for the delay; been out of town. I'm using asdf v0.6.3. I really only have Erlang for using Elixir, however, the app I'm apart of building is using Mnesia. This project is still in early stages, so I'm typically running iex -S mix or mix test for development. Still fairly green on understanding some of the Elixir/Erlang connection; things like the beam, etc.

Stratus3D commented 5 years ago

Each of those processes appears to have been started by mix help credo? (See the end of each line in your output). That doesn't seem right, as mix help credo should just print the help message and exit. Can you see if mix help credo causes more processes to be spawned? If so it's likely an issue related to Mix or Credo. I'm not aware of anything in asdf or asdf-erlang that would cause this.

Stratus3D commented 5 years ago

One similar issue that I experienced a couple months ago was with a linter plugin I had installed in Vim. It contained a bug which caused numerous erl compilers to be started and never finish. Eventually I had a couple dozen erl processes running in the background.

khipukamayuq commented 5 years ago

Interesting. Thanks for the info. I've just tried replicating the issue by running mix help credo and variations on that and am not able to do so. I have been using Vim recently; in fact using Vim was where I first noticed the system freeze from so many processes. I'll head that way for more help. Thanks again!

Stratus3D commented 5 years ago

Closing this issue since I don't think asdf-erlang is the culprit here.