nx-console: NX console blocks VSCode's SCM

Current Behavior

I confirm that this issue doesn’t exist on the VSCode extension in v17.18.7 but starting 17.18.8, the extension blocks the Git SCM on VSCode and the SCM becomes unresponsive during many operations such as discarding changes, opening diff etc. Here are the logs from the Output tab:

With version 17.18.7:

[2022-09-23T05:08:27.913Z] Log level: Info
[2022-09-23T05:08:27.953Z] [info] Validating found git in: /usr/bin/git
[2022-09-23T05:08:27.998Z] [info] Using git 2.37.0 (Apple Git-136) from /usr/bin/git
[2022-09-23T05:08:29.611Z] > git rev-parse --show-toplevel [1600ms]
[2022-09-23T05:08:29.706Z] > git rev-parse --git-dir --git-common-dir [85ms]
[2022-09-23T05:08:29.717Z] [info] Open repository: /workspace/project
[2022-09-23T05:08:30.585Z] > git status -z -uall [863ms]
[2022-09-23T05:08:30.637Z] > git symbolic-ref --short HEAD [51ms]
[2022-09-23T05:08:30.681Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [42ms]
[2022-09-23T05:08:30.725Z] > git remote --verbose [39ms]
[2022-09-23T05:08:30.919Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [236ms]
[2022-09-23T05:08:30.964Z] > git config --get commit.template [30ms]
[2022-09-23T05:08:31.749Z] > git status -z -uall [780ms]
[2022-09-23T05:08:31.788Z] > git symbolic-ref --short HEAD [37ms]
[2022-09-23T05:08:31.826Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [34ms]
[2022-09-23T05:08:31.868Z] > git remote --verbose [38ms]
[2022-09-23T05:08:31.881Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [54ms]
[2022-09-23T05:08:31.918Z] > git config --get commit.template [29ms]
[2022-09-23T05:10:04.537Z] > git status -z -uall [455ms]
[2022-09-23T05:10:04.559Z] > git symbolic-ref --short HEAD [21ms]
[2022-09-23T05:10:04.583Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [23ms]
[2022-09-23T05:10:04.612Z] > git remote --verbose [27ms]
[2022-09-23T05:10:04.718Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [134ms]
[2022-09-23T05:10:04.746Z] > git config --get commit.template [22ms]
[2022-09-23T05:12:24.115Z] > git status -z -uall [393ms]
[2022-09-23T05:12:24.137Z] > git symbolic-ref --short HEAD [21ms]
[2022-09-23T05:12:24.162Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [22ms]
[2022-09-23T05:12:24.188Z] > git remote --verbose [24ms]
[2022-09-23T05:12:24.285Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [122ms]
[2022-09-23T05:12:24.307Z] > git config --get commit.template [19ms]

With version 17.18.8

[2022-09-23T05:12:56.095Z] Log level: Info
[2022-09-23T05:12:56.222Z] [info] Validating found git in: /usr/bin/git
[2022-09-23T05:12:56.274Z] [info] Using git 2.37.0 (Apple Git-136) from /usr/bin/git
[2022-09-23T05:12:56.323Z] > git rev-parse --show-toplevel [40ms]
[2022-09-23T05:12:56.357Z] > git rev-parse --git-dir --git-common-dir [27ms]
[2022-09-23T05:12:56.361Z] [info] Open repository: /workspace/project
[2022-09-23T05:12:57.238Z] > git status -z -uall [874ms]
[2022-09-23T05:12:57.289Z] > git symbolic-ref --short HEAD [50ms]
[2022-09-23T05:12:57.320Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [30ms]
[2022-09-23T05:12:57.375Z] > git remote --verbose [51ms]
[2022-09-23T05:12:57.378Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [56ms]
[2022-09-23T05:12:57.410Z] > git config --get commit.template [24ms]
[2022-09-23T05:15:32.868Z] > git status -z -uall [155454ms]
[2022-09-23T05:15:32.924Z] > git symbolic-ref --short HEAD [51ms]
[2022-09-23T05:15:32.956Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/heads/dev_branch refs/remotes/heads/dev_branch [28ms]
[2022-09-23T05:15:32.984Z] > git remote --verbose [26ms]
[2022-09-23T05:15:33.148Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [191ms]
[2022-09-23T05:15:33.398Z] > git config --get commit.template [83ms]

Specifically, the command git status -z -uall takes a whopping 155454ms in the newer version.

Expected Behavior

SCM should not be blocked by this extension. This seems to be a regression.

Environment

❯ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.17.0
   OS   : darwin x64
   npm  : 8.15.0

   nx : 14.1.11
   @nrwl/angular : 14.1.11
   @nrwl/cypress : 14.1.11
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.11
   @nrwl/eslint-plugin-nx : 14.1.11
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.11
   @nrwl/js : Not Found
   @nrwl/linter : 14.1.11
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.6.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.1.11
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.11
   typescript : 4.6.3
   ---------------------------------------
   Community plugins:
   	 rxjs: 6.6.7
   	 single-spa-angular: 6.3.1
   	 @ngneat/spectator: 10.0.1
   	 @storybook/angular: 6.4.21
   	 ngx-build-plus: 13.0.1
   	 nx-stylelint: 12.2.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (12 by maintainers)

Most upvoted comments

So, we won’t turn run nx reset for you automatically because it removes all existing cache files. So we’ll just use a previous version of the graph if we come across a disabled daemon

No, it’s fine. I’m going to release a new version that puts the project graph creation/gathering in another process. This means that there’s no heavy operations that should be running on the main thread, and shouldn’t block other extensions now.

Sorry, but the latest update doesn’t solve the problem either. If it helps, I have “useDaemonProcess” set to false in my workspace’s nx.json. v17.18.7 of this extension still works absolutely fine.

Ok now I actually found the issue 😅

This appears to happen when the Nx daemon disables itself and we try to get the project graph again. When the daemon is disabled, the process happens on the main thread rather than the daemon, and that takes a while to get the graph (depending on the size).

So in the meantime, if you come across this issue, try running nx reset in your terminal and do the git operations again.

I’m going to add a way to automatically reset the daemon when we detect its disabled and hopefully get this fixed away.

Thanks everyone for their patience!

I got the Nx Console add-on during an Nx upgrade in about July, and at the same time also had a sudden severe slowdown in VSCode - but I didn’t make the connection then. I described my experience in this existing VSCode ticket. When I read the followup by @31piy I uninstalled Nx Console and now the problem is gone.

So, I think this is more than coincidence.

  1. This happens with the latest version too
  2. Yeah, that’s how I narrowed it down to this extension. Disabling this extension got the SCM work fine.

Regarding the .gitignore, I have a git repo structure as following:

my-repo
  - project1
  - project2
  - project3
  - ...
  - .git
  - .gitignore

Out of this structure, consider project3 an nx monorepo (with nx.json, package.json, apps and libs directories and a lot more). My gitignore is pretty much decent:

  1 */node_modules/
  2 */dist/
  3 */build/
  4 proxy*.conf*.js*
  5 */**/coverage
  6 */**/cypress/a11y
  7 */**/cypress/videos
  8 */**/cypress/downloads
  9 */**/cypress/screenshots
 10 .angulardoc.json
 11 .DS_Store
 12 .vscode
 13 .idea
 14 .nyc_output
 15 project3/libs/api/**/generated