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

The "languageserver.bash" server crashed 4 times in the last 3 minutes. The server will not be restarted #353

Closed
isak102 opened this issue May 6, 2022 · 22 comments

Comments

@isak102
Copy link

isak102 commented May 6, 2022

Opening a .sh file in neovim and waiting around 4 seconds leads to this issue. The language server crashes and doesn't work whatsoever. I have tried reinstalling node, bash-language-server and coc multiple times with no success.

This started happening a few days ago, don't think I have changed anything. This is the output of :CocCommand workspace.showOuptut:

node:internal/deps/undici/undici:4816
            throw new TypeError("Failed to parse URL from " + input, { cause: err });
                  ^

TypeError: Failed to parse URL from /usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.wasm
    at new Request (node:internal/deps/undici/undici:4816:19)
    at Agent2.fetch2 (node:internal/deps/undici/undici:5544:29)
    ... 4 lines matching cause stack trace ...
    at /usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.js:1:144
    at Object.<anonymous> (/usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.js:1:170)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:377:5)
      at URL.onParseError (node:internal/url:563:9)
      at new URL (node:internal/url:643:5)
      at new Request (node:internal/deps/undici/undici:4814:25)
      at Agent2.fetch2 (node:internal/deps/undici/undici:5544:29)
      at Object.fetch (node:internal/deps/undici/undici:6372:20)
      at fetch (node:internal/bootstrap/pre_execution:199:25)
      at /usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.js:1:15041
      at /usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.js:1:15262
      at /usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.js:1:144 {
    input: '/usr/lib/node_modules/bash-language-server/node_modules/web-tree-sitter/tree-sitter.wasm',
    code: 'ERR_INVALID_URL'
  }
}
@mrdotx
Copy link

mrdotx commented May 7, 2022

I have the same problem. A temporary solution for me is to downgrade nodejs from 18.1.0 to 17.9.0 on Arch Linux...

@isak102
Copy link
Author

isak102 commented May 7, 2022

I have the same problem. A temporary solution for me is to downgrade nodejs from 18.1.0 to 17.9.0 on Arch Linux...

This worked for me too. Probably a bug in nodejs 18.1 then

@xiaobaiseven
Copy link

I have the same problem when i upgraded nodejs-18.1.0.

@realSaltyFish
Copy link

Same here. Downgraded to 17.9.0 for now.

archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 8, 2022
- Pin older Node.js due to bash-lsp/bash-language-server#353

- Built with nodejs-lts-gallium


git-svn-id: file:///srv/repos/svn-community/svn@1196316 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 8, 2022
- Pin older Node.js due to bash-lsp/bash-language-server#353

- Built with nodejs-lts-gallium

git-svn-id: file:///srv/repos/svn-community/svn@1196316 9fca08f4-af9d-4005-b8df-a31f2cc04f65
@isak102
Copy link
Author

isak102 commented May 18, 2022

@mrdotx @realSaltyFish @xiaobaiseven Have you found any solutions? Node has gotten a new version, 18.2.0, and it still doesn't work

@Alexey104
Copy link

Node has gotten a new version, 18.2.0, and it still doesn't work

Confirm. Works with 18.0.0.

@polyzen
Copy link
Contributor

polyzen commented May 18, 2022 via email

@Alexey104
Copy link

I'm on 3.0.2.

@isak102
Copy link
Author

isak102 commented May 18, 2022

On May 18, 2022 1:37:18 PM EDT, isak102 @.***> wrote: @mrdotx @realSaltyFish @xiaobaiseven Have you found any solutions? Node has gotten a new version, 18.2.0, and it still doesn't work
What version of bash-ls are you on? This should already be fixed in 3.0.1.

-- Best, Daniel https://danielcapella.com

I am on 3.0.2 and it doesn't work

@Alexey104
Copy link

With bash-ls 3.0.2 and nodejs 18.2.0 I get Server languageserver.bash failed to start: Error: Connection to server got closed. Server will not be restarted. No problems with nodejs 18.0.0.

@mrdotx
Copy link

mrdotx commented May 18, 2022

On May 18, 2022 1:37:18 PM EDT, isak102 @.***> wrote: @mrdotx @realSaltyFish @xiaobaiseven Have you found any solutions? Node has gotten a new version, 18.2.0, and it still doesn't work
What version of bash-ls are you on? This should already be fixed in 3.0.1.

-- Best, Daniel https://danielcapella.com

I'm also on 3.0.2 and it still doesn't work with 18.2.0

@skovhus
Copy link
Collaborator

skovhus commented May 18, 2022

I cannot reproduce this locally, so I would love you to paste the output from running:

  • bash-language-server --version (to ensure the version you are on, and to see if that crashes)
  • bash-language-server start (a stack trace I assume?)

@Alexey104
Copy link

Alexey104 commented May 18, 2022

Sure.

alexey@archlinux: ~
bash-language-server --version                                                                                                 
Version is 3.0.2

alexey@archlinux: ~
node --version                                                                                                                
v18.2.0

bash-language-server start does not give any output at all if executed manually in CLI, but nvim shows this at startup:
bash-ls

I am not sure, maybe this is rather related to Coc.nvim than to bash-ls, but there are no problems with other language servers, only bash-ls fails to start.

@WhoIsSethDaniel
Copy link

WhoIsSethDaniel commented May 18, 2022

I also have this issue. I have the same error as reported in the first comment.

$ ./bash-language-server --version
Version is 3.0.2

$ node --version
v18.2.0

bash-language-server start does not produce any errors. It's only once the client contacts the server that the error occurs.

This is with Neovim 0.7.0 and the latest nvim-lspconfig.
I install bashls using nvim-lsp-installer.

@skovhus
Copy link
Collaborator

skovhus commented May 18, 2022

Thanks! I've reproduced the issue locally now by running the automated tests (yarn test). https://github.com/bash-lsp/bash-language-server/blob/master/server/src/parser.ts#L23 hangs on node 18...

@maxbrunsfeld do you know of any issues using web-tree-sitter or with node 18? The Parser.Language.load function just hangs...

@gegoune
Copy link

gegoune commented May 18, 2022

That's what nvim gives in logs, hope it helps (3.0.2 & v18.1.0):

[ERROR][2022-05-19 00:09:19] .../vim/lsp/rpc.lua:428    "rpc"   "bash-language-server"  "stderr"        "node:internal/deps/undici/undici:4816
            throw new TypeError(\"Failed to parse URL from \" + input, { cause: err });
                  ^

TypeError: Failed to parse URL from /Users/gegoune/.pnpm-global/5/.pnpm/web-tree-sitter@0.20.5/node_modules/web-tree-sitter/tree-sitter.wasm
    at new Request (node:internal/deps/undici/undici:4816:19)
    at Agent2.fetch2 (node:internal/deps/undici/undici:5544:29)
    ... 4 lines matching cause stack trace ...
    at new Promise (<anonymous>)
    at Function.init (/Users/gegoune/.pnpm-global/5/.pnpm/web-tree-sitter@0.20.5/node_modules/web-tree-sitter/tree-sitter.js:1:332)
    at Object.<anonymous> (/Users/gegoune/.pnpm-global/5/.pnpm/bash-language-server@3.0.2/node_modules/bash-language-server/out/parser.js:16:22)
    at Generator.next (<anonymous>) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:377:5)
      at URL.onParseError(node:internal/url:563:9)
      at new URL (node:internal/url:643:5)
      at new Request (node:internal/deps/undici/undici:4814:25)
      at Agent2.fetch2 (node:internal/deps/undici/undici:5544:29)
      at Object.fetch (node:internal/deps/undici/undici:6372:20)
      at fetch (node:internal/bootstrap/pre_execution:199:25)
      at /Users/gegoune/.pnpm-global/5/.pnpm/web-tree-sitter@0.20.5/node_modules/web-tree-sitter/tree-sitter.js:1:15192
      at /Users/gegoune/.pnpm-global/5/.pnpm/web-tree-sitter@0.20.5/node_modules/web-tree-sitter/tree-sitter.js:1:15413
      at new Promise (<anonymous>) {
    input: '/Users/gegoune/.pnpm-global/5/.pnpm/web-tree-sitter@0.20.5/node_modules/web-tree-sitter/tree-sitter.wasm',
    code: 'ERR_INVALID_URL'
  }
}

Node.js v18.1.0
"

@skovhus
Copy link
Collaborator

skovhus commented May 22, 2022

A temporary workaround is to start the language server using the --no-experimental-fetch flag:

node --no-experimental-fetch $(which bash-language-server) --start  

@gegoune @WhoIsSethDaniel Can you verify if that works for you?

Additional context

I've looked into this and the node.js support for fetch conflicts with some of the wasm code generated by emscripten – a downstream fix is here and issue here.

I've validated this by disabling fetch using --no-experimental-fetch when running test:

node --no-experimental-fetch  node_modules/.bin/jest server/src/__tests__/server.test.ts

@skovhus
Copy link
Collaborator

skovhus commented May 22, 2022

Version 3.0.3 has just been released with a workaround. Let me know if it works. :)

@RealStickman
Copy link

Version 3.0.3 works for me with node 18.2.0

@Alexey104
Copy link

Yes, 3.0.3 works, thank you for fixing it!

@WhoIsSethDaniel
Copy link

3.0.3 wfm as well. Thank you.

@storopoli
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests