VS Code 进程“ruby"在 100% CPU 运行的 MacOS 上:如何修复? [英] VS Code process "ruby" on MacOS running at 100% CPU: how to fix?

查看:20
本文介绍了VS Code 进程“ruby"在 100% CPU 运行的 MacOS 上:如何修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为我的 Ruby on Rails 开发项目运行 Visual Studio Code 时,有一个ruby"进程持续以几乎 100% 的 CPU 运行,这让我的粉丝疯狂旋转.在活动监视器中查看该进程的打开文件和端口,看起来这是由某个进程(node_modules.asar?) 扫描数据目录 (my_project/public/system/**):

When running Visual Studio Code for my Ruby on Rails development project, there is a 'ruby' process constantly running at almost 100% CPU making my fans spin like crazy. Looking at the Open Files and Ports of that process in the Activity Monitor, it looks like this is being caused by some process (node_modules.asar?) scanning through data directories (my_project/public/system/**):

cwd
/Users/pascal/projects/RoR/my_project
txt
/Users/pascal/.rbenv/versions/2.4.4/bin/ruby
txt
/usr/local/Cellar/gmp/6.1.2_2/lib/libgmp.10.dylib
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/encdb.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/trans/transdb.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/stringio.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/etc.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/digest/sha1.bundle
txt
/usr/local/Cellar/openssl/1.0.2o_2/lib/libcrypto.1.0.0.dylib
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/digest.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle
txt
/usr/local/Cellar/openssl/1.0.2o_2/lib/libssl.1.0.0.dylib
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/io/nonblock.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/io/console.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/zlib.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/socket.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/io/wait.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/windows_31j.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/json-2.1.0/lib/json/ext/parser.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/json-2.1.0/lib/json/ext/generator.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/ripper.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/cgi/escape.bundle
txt
/Library/Preferences/Logging/.plist-cache.KjBd2ZgB
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle
txt
/usr/local/Cellar/readline/7.0.3_1/lib/libreadline.7.0.dylib
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7/lib/rubyeventmachine.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/date_core.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/psych.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/strscan.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/utf_16le.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/utf_16be.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/racc/cparse.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/enc/trans/single_byte.bundle
txt
/Users/pascal/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.5/lib/nokogiri/nokogiri.bundle
txt
/usr/local/Cellar/xz/5.2.4/lib/liblzma.5.dylib
txt
/usr/lib/dyld
0
->(none)
1
->(none)
2
->(none)
3
->0xebb30f785d0d6639
4
->0xebb30f785d0d4fb9
5
->0xebb30f785d0d70b9
6
->0xebb30f785d0d7b39
7
/dev/null
8
->0xebb30f785d0d7bf9
9
->0xebb30f785d0d6e79
10
localhost:59701
11
localhost:59701->localhost:59702
12
[ctl com.apple.netsrc id 9 unit 64]
13
->0xebb30f7867f30159
14
192.168.10.31:59810->151.101.0.70:https
15
/Users/pascal/projects/RoR/my_project
16
/Users/pascal/projects/RoR/my_project/public
17
/Users/pascal/projects/RoR/my_project/public/system
18
/Users/pascal/projects/RoR/my_project/public/system/dragonfly
19
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test
20
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images
21
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662
22
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017
23
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017/12
24
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017/12/08
25
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017/12/08/13
26
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017/12/08/13/11
27
/Users/pascal/projects/RoR/my_project/public/system/dragonfly/test/images/662/2017/12/08/13/11/27
36
/dev/ptmx
38
/private/var/folders/fn/wjmjy_xj1vv2n8lhfcsjb3480000gn/T/com.microsoft.VSCode.ShipIt.3TPnSs1E/Visual Studio Code.app/Contents/Resources/app/node_modules.asar

我希望一些 exclude folders 设置可以解决这个问题,但我找不到任何相关设置.或者有其他解决方案吗?

I'm hoping that some exclude folders settings would fix this, but I cannot find any relevant setting. Or is there another solution for this?

推荐答案

这原来是由 Solargraph gem 引起的.根据作者的这个解释.solargraph.yml 文件中此 gem 的 exclude 设置不能很好地工作.相反,应该使用更具体的 include 设置.就我而言,我使用 - **/*.rb 作为单个包含设置.我现在已将其更改为:

This turned out to be caused by the Solargraph gem. According to this explanation of the author, the exclude settings of this gem in the .solargraph.yml file don't work very well. Instead one should use more specific include settings. In my case I was using - **/*.rb as a single include setting. I've now changed this to:

include:
- app/**/*.rb
- db/migrate/**/*.rb
- db/seeds/**/*.rb
- config/**/*.rb
- lib/**/*.rb 
- spec/**/*.rb 

从那时起,ruby 进程似乎被驯服了.

Since then the ruby process seems to be tamed.

这篇关于VS Code 进程“ruby"在 100% CPU 运行的 MacOS 上:如何修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆