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

Client Biome: connection to server is erroring. Shutting down server #650

Closed
PaulBurridge opened this issue Nov 1, 2023 · 11 comments · Fixed by #654
Closed

Client Biome: connection to server is erroring. Shutting down server #650

PaulBurridge opened this issue Nov 1, 2023 · 11 comments · Fixed by #654
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Needs response Status: await response from OP

Comments

@PaulBurridge
Copy link

Connection to server occasionally errors.

Log includes Biome - Restart LSP Server action after error after which Biome extension appears to function normally again.

Configuration file required, looking for one.
Config file found at /workspace/gbr-tms2-portal/biome.json, enabling Biome extension
Using Biome from /home/dev/.vscode-server/extensions/biomejs.biome-1.6.2-linux-x64/server/biome
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 9:01:23 AM] Server initialized with PID: 21215
[cli-stderr] data 425
[Info  - 12:07:18 PM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 12:07:19 PM] Server initialized with PID: 168445
[cli-stderr] data 425
[Info  - 12:07:49 PM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 12:07:50 PM] Server initialized with PID: 168923
[cli-stderr] data 425
[Info  - 12:09:31 PM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[cli-stderr] data 425
[Error - 12:09:32 PM] Client Biome: connection to server is erroring. Shutting down server.
[Error - 12:09:32 PM] Client Biome: connection to server is erroring. Shutting down server.
[Error - 12:09:32 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:09:32 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:09:32 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 12:24:46 PM] Server initialized with PID: 182427

Windows 11 attached to container in WSL

Version: 1.83.1 (user setup)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:48:05.904Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22000
@PaulBurridge
Copy link
Author

This is getting more frequent

[Info  - 9:01:38 AM] Server initialized with PID: 41826
[cli-stderr] data 425
[Info  - 9:01:38 AM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 9:01:39 AM] Server initialized with PID: 41868
[cli-stderr] data 425
[Info  - 9:02:31 AM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 9:02:32 AM] Server initialized with PID: 42824
[cli-stderr] data 425
[Info  - 9:02:32 AM] Connection to server got closed. Server will restart.
true
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[cli-stdout] data 24
[cli] exit 0
Connecting to "/tmp/biome-socket-1.3.2" ...
[Info  - 9:02:33 AM] Server initialized with PID: 42860
[cli-stderr] data 425
[Error - 9:04:09 AM] The Biome server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

@nhedger nhedger transferred this issue from biomejs/biome-vscode Nov 2, 2023
@nhedger nhedger added A-Editors Area: editors A-LSP Area: language server protocol labels Nov 2, 2023
@ematipico
Copy link
Member

@PaulBurridge-Nasstar

Could you check the logs of the daemon and see if there are errors? You can find the logs in a folder called biome-logs; this folder should be in the temporary folder of your OS.

Alternatively, you could try to run biome rage --daemon-logs and the command should print a bunch of logs. Please paste the result here. If possible, try paste the section of logs that are printed when you see the error.

@PaulBurridge
Copy link
Author

Hi this block seems to be related to the issue, let me know if you need more of the log:

/tmp/biome-logs/server.log.2023-11-02-09-│ │ ├─┐biome_js_parser::parse::parse{}
/tmp/biome-logs/server.log.2023-11-02-09-│ │ ├─┘
/tmp/biome-logs/server.log.2023-11-02-09-│ │ ├─┐biome_service::workspace::server::Pulling diagnostics{categories=RuleCategories(SYNTAX | LINT | ACTION)}
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─0ms INFO biome_service::file_handlers::javascript Analyze file js/src/form-validation.js
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ ├─2ms DEBUG biome_rowan::ast::batch pushing change...
/tmp/biome-logs/server.log.2023-11-02-09:│ │ │ ├─3ms ERROR biome_cli::panic Biome encountered an unexpected error
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ 
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ 
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ Source Location: /home/runner/work/biome/biome/crates/biome_js_semantic/src/semantic_model/model.rs:334:46
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ Thread Name: tokio-runtime-worker
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ Message: no entry found for key
/tmp/biome-logs/server.log.2023-11-02-09-│ │ │ │ 
/tmp/biome-logs/server.log.2023-11-02-09-│ │ ├─┘
/tmp/biome-logs/server.log.2023-11-02-09-│ ├─┘
/tmp/biome-logs/server.log.2023-11-02-09-├─┘
grep "model.rs:334:46" /tmp/biome-logs/server.log* -c | grep -v ":0"
/tmp/biome-logs/server.log.2023-10-24-08:2
/tmp/biome-logs/server.log.2023-10-31-14:2
/tmp/biome-logs/server.log.2023-11-01-12:6
/tmp/biome-logs/server.log.2023-11-02-08:2
/tmp/biome-logs/server.log.2023-11-02-09:10

Also a historic panic but this has not happened since 2023-10-11:

/tmp/biome-logs/server.log.2023-10-11-11-├─┐biome_lsp::handlers::text_document::did_change{url=file:///workspace/gbr-tms2-portal/js/src/form-validation.js, version=169}
/tmp/biome-logs/server.log.2023-10-11-11-│ ├─┐biome_lsp::session::update_diagnostics{url=file:///workspace/gbr-tms2-portal/js/src/form-validation.js}
/tmp/biome-logs/server.log.2023-10-11-11-│ │ ├─┐biome_js_parser::parse::parse{}
/tmp/biome-logs/server.log.2023-10-11-11-│ │ ├─┘
/tmp/biome-logs/server.log.2023-10-11-11:│ │ ├─1ms ERROR biome_cli::panic Biome encountered an unexpected error
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ 
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ 
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ Source Location: crates/biome_js_syntax/src/expr_ext.rs:633:26
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ Thread Name: tokio-runtime-worker
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ Message: begin <= end (1 <= 0) when slicing `/console.log("newState", newState);`
/tmp/biome-logs/server.log.2023-10-11-11-│ │ │ 
/tmp/biome-logs/server.log.2023-10-11-11-│ ├─┘
/tmp/biome-logs/server.log.2023-10-11-11-├─┘

@ematipico
Copy link
Member

ematipico commented Nov 2, 2023

Thank you @PaulBurridge-Nasstar ! This isn't an issue with the editor but an issue biome source code.

It would be great to have the content of the file that generates this panic/error.

@ematipico ematipico added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages and removed A-Editors Area: editors A-LSP Area: language server protocol labels Nov 2, 2023
@ematipico
Copy link
Member

@Conaclos you might be interested in this, it seems that one error is thrown by the semantic model

@ematipico ematipico added the S-Needs response Status: await response from OP label Nov 2, 2023
@PaulBurridge
Copy link
Author

None of the files I have trigger the error at the moment, as such I suspect it may happen when the file is in an invalid state during development.

I will let you know if and when I can recreate.

@Conaclos
Copy link
Member

Conaclos commented Nov 2, 2023

None of the files I have trigger the error at the moment, as such I suspect it may happen when the file is in an invalid state during development.

I will let you know if and when I can recreate.

I also suspect that a binding is not resolved because it is a bogus node. Still it could help to have an example.

@PaulBurridge
Copy link
Author

We have some code that recreates the issue:

(() => {
  // Initialise.
  for (const))
  Array.from(document.getElementsByClassName("copy-button")).forEach((element) => {
    element.addEventListener("click", copyToClipboard);
    element.classList.remove("d-none");
  });
})();

├─┐biome_lsp::handlers::text_document::did_open{params=DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/workspace/gbr-tms2-portal/js/src/xxx.js", query: None, fragment: None }, language_id: "javascript", version: 9, text: "(() => {\n  // Initialise.\n  for (const))\n  Array.from(document.getElementsByClassName(\"copy-button\")).forEach((element) => {\n    element.addEventListener(\"click\", copyToClipboard);\n    element.classList.remove(\"d-none\");\n  });\n})();\n" } }}
│ ├─┐biome_lsp::session::update_diagnostics{url=file:///workspace/gbr-tms2-portal/js/src/xxx.js}
│ │ ├─┐biome_js_parser::parse::parse{}
│ │ ├─┘
│ │ ├─┐biome_service::workspace::server::Pulling diagnostics{categories=RuleCategories(SYNTAX | LINT | ACTION)}
│ │ │ ├─0ms INFO biome_service::file_handlers::javascript Analyze file js/src/xxx.js
│ │ │ ├─0ms DEBUG biome_rowan::ast::batch pushing change...
│ │ │ ├─1ms ERROR biome_cli::panic Biome encountered an unexpected error
│ │ │ │ 
│ │ │ │ This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:
│ │ │ │ 
│ │ │ │ Source Location: /home/runner/work/biome/biome/crates/biome_js_semantic/src/semantic_model/model.rs:334:46
│ │ │ │ Thread Name: tokio-runtime-worker
│ │ │ │ Message: no entry found for key
│ │ │ │ 
│ │ ├─┘
│ ├─┘
├─┘
┘
INFO biome_cli::commands::daemon Received shutdown signal

@Conaclos
Copy link
Member

Conaclos commented Nov 2, 2023

Thanks! This is really helpful! The bug should now fix by #654. However, this produces another bug in noUnusedVariables code fix. I keep the issue open until this newly discovered bug is fixed.

@PaulBurridge
Copy link
Author

Smaller version in case it helps

(const)
a

@Conaclos
Copy link
Member

Conaclos commented Nov 2, 2023

The bug I talked is not really a bug: it is an assertion that ensure that a code fix emits non-bogus tree. Since the input is necessarily bogus, the output is also bogus.

The current issue was fixed in #654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Needs response Status: await response from OP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants