bazel-contrib / vscode-bazel

Bazel support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=BazelBuild.vscode-bazel
Apache License 2.0
238 stars 77 forks source link

bazel query getting stuck #227

Open Michaelhobo opened 3 years ago

Michaelhobo commented 3 years ago

The Bazel extension occasionally gets stuck. I think it usually happens when bazel crashes once, and leaves the lock file around. I start getting errors that continuously pop up, which look like this:

Bazel Build Targets: Command failed: bazel --output_base=/tmp/6a622852f8f9062446271ea7e15aa515 query ...:* --output=package 
Another command holds the client lock: pid=58100 owner=client cwd=/workspace/___
Waiting for it to complete... 
Another command holds the client lock: pid=58342 owner=client cwd=/workspace/___
Waiting for it to complete... 
...
 WARNING: Waiting for server process to terminate (waited 5 seconds, waiting at most 10)
WARNING: Waiting for server process to terminate (waited 10 seconds, waiting at most 10)
INFO: Waited 10 seconds for server process (pid=42461) to terminate.
FATAL: Attempted to kill stale server process (pid=42461) using SIGKILL, but it did not die in a timely fashion.

I tried deleting /tmp/616.../lock, but the errors continue showing up.

And I have a lot of bazel processes that keep changing PIDs:

$ ps aux | grep bazel | wc -l
524

For now, I really just need syntax highlighting. Is there a way to disable the continuous queries until this issues is fixed?

sluongng commented 3 years ago

Same issue here.

Its also a bit weird that the extension is using a different output_base than what I have in my .bazelrc file

cameron-martin commented 8 months ago

@sluongng This extension uses a different output base to prevent concurrent builds from blocking IDE features. See https://bazel.build/run/scripts#output-base-option

mikedanese commented 5 months ago

I hit this:

$ ps ax | grep bazel |wc -l
     648

vscode spanned hundreds of subprocesses all requesting the same query kind(rule, //kubernetes:all).

 | | |--- 01964 mike.danese /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/mike.danese/.vscode/
extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js --stdio --clientProcessId=1873
 | | |-+- 32934 mike.danese bash bazel query kind(rule, //kubernetes:all) --output=proto --proto:output_rule_attrs='' --noproto:rule_inputs_and_outputs --noproto:default_values
 | | | \-+- 33000 mike.danese /bin/bash bazel query kind(rule, //kubernetes:all) --output=proto --proto:output_rule_attrs='' --noproto:rule_inputs_and_outputs --noproto:default_values

Funnily enough, the "Helper" mentioned a different extenson, stylelint.vscode-stylelint, and not bazel. I uninstalled that plugin and the error went away.

Not sure how, but it seems like other extensions can trigger vscode-bazel to fork bomb.