code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Bug]: Scala[Metals] would report "failed to connect with build server."

Open Readon opened this issue 2 years ago • 14 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS/Web Information

  • Web Browser: Edge
  • Local OS: Windows 10
  • Remote OS: Ubuntu 18
  • Remote Architecture: x86_64
  • code-server --version: 4.4.0

Steps to Reproduce

  1. open code-server
  2. install Scala[Metals] extension.
  3. open a scala project.

Expected

metals works.

Actual

Report "Failed to connect the build server, no functionality will work."

Logs

The metals would report as below.

2022.06.13 10:58:52 ERROR Failed to connect with build server, no functionality will work.
java.lang.NullPointerException
	at scala.meta.internal.mtags.CommonMtagsEnrichments$XtensionPathMetals.filename(CommonMtagsEnrichments.scala:308)
	at scala.meta.internal.mtags.CommonMtagsEnrichments$XtensionAbsolutePath.filename(CommonMtagsEnrichments.scala:469)
	at scala.meta.internal.metals.JdkSources$.isJdkCandidate$1(JdkSources.scala:37)
	at scala.meta.internal.metals.JdkSources$.$anonfun$candidates$2(JdkSources.scala:47)
	at scala.collection.immutable.List.map(List.scala:246)
	at scala.meta.internal.metals.JdkSources$.candidates(JdkSources.scala:44)
	at scala.meta.internal.metals.JdkSources$.apply(JdkSources.scala:20)
	at scala.meta.internal.metals.doctor.ProblemResolver.javaSourcesProblem$1(ProblemResolver.scala:223)
	at scala.meta.internal.metals.doctor.ProblemResolver.$anonfun$findProblem$5(ProblemResolver.scala:291)
	at scala.Option.orElse(Option.scala:477)
	at scala.meta.internal.metals.doctor.ProblemResolver.findProblem(ProblemResolver.scala:291)
	at scala.meta.internal.metals.doctor.ProblemResolver.$anonfun$problemMessage$1(ProblemResolver.scala:67)
	at scala.collection.immutable.List.flatMap(List.scala:293)
	at scala.meta.internal.metals.doctor.ProblemResolver.problemMessage(ProblemResolver.scala:66)
	at scala.meta.internal.metals.doctor.Doctor.check(Doctor.scala:165)
	at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$connectToNewBuildServer$8(MetalsLanguageServer.scala:2345)
	at scala.meta.internal.metals.Indexer.$anonfun$indexWorkspace$6(Indexer.scala:220)
	at scala.meta.internal.metals.TimerProvider.timedThunk(TimerProvider.scala:25)
	at scala.meta.internal.metals.Indexer.indexWorkspace(Indexer.scala:219)
	at scala.meta.internal.metals.Indexer.$anonfun$profiledIndexWorkspace$2(Indexer.scala:140)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.meta.internal.metals.TimerProvider.timedThunk(TimerProvider.scala:25)
	at scala.meta.internal.metals.Indexer.$anonfun$profiledIndexWorkspace$1(Indexer.scala:140)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:678)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Screenshot/Video

No response

Does this issue happen in VS Code?

  • [X] I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • [X] I am using HTTPS.

Notes

Actually i am not using https now. I just follow the instruction on installation page of documentation, and install code-server through apt on Ubuntu.

Readon avatar Jun 13 '22 03:06 Readon

Hmm...is it only this extension?

Does this extension work with GitHub Codespaces?

jsjoeio avatar Jun 13 '22 14:06 jsjoeio

I think this is the only full suite for scala on vscode. I did not tried GitHub Codespaces, but vscode.

Readon avatar Jun 13 '22 15:06 Readon

Can you please try GitHub Codespaces?

jsjoeio avatar Jun 13 '22 17:06 jsjoeio

Can you please try GitHub Codespaces?

Unfortunately, I don't have any access to codespaces.

Readon avatar Jun 14 '22 05:06 Readon

Isn't it available to everyone?

jsjoeio avatar Jun 15 '22 20:06 jsjoeio

no,it should be required by orgnization

---Original--- From: "Joe @.> Date: Thu, Jun 16, 2022 04:14 AM To: @.>; Cc: @.@.>; Subject: Re: [coder/code-server] [Bug]: Scala[Metals] would report "failed to connect with build server." (Issue #5259)

Isn't it available to everyone?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Readon avatar Jun 16 '22 01:06 Readon

Isn't it available to everyone?

When I tried to click "Your codespaces"

It reports that "None of your organizations have access to Codespaces yet."

Readon avatar Jun 16 '22 13:06 Readon

Weird 🤔

And this page doesn't work, I suppose? https://github.com/features/codespaces

jsjoeio avatar Jun 16 '22 15:06 jsjoeio

I followed the quickstart tutorial,however, there is no 'Create codespace on main.' under my 'code' push button。

---Original--- From: "Joe @.> Date: Thu, Jun 16, 2022 23:13 PM To: @.>; Cc: @.@.>; Subject: Re: [coder/code-server] [Bug]: Scala[Metals] would report "failed to connect with build server." (Issue #5259)

Weird 🤔

And this page doesn't work, I suppose? https://github.com/features/codespaces

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Readon avatar Jun 17 '22 00:06 Readon

I found that if i start the service through "/usr/bin/code-server", the bloop could work. However, if it is started by "systemctl start code-server@xxxx", it would fail.

Readon avatar Jun 17 '22 16:06 Readon

Interesting! That sounds like a permissions error then, right? cc @code-asher any ideas?

jsjoeio avatar Jun 17 '22 16:06 jsjoeio

When you run /usr/bin/code-server are you using the same user you use for systemctl start code-server@$user?

Are there any more logs? For example in the browser console or the output panel or in ~/.local/share/code-server/logs.

Does this help at all? https://github.com/scalameta/metals/issues/1627

code-asher avatar Jun 21 '22 19:06 code-asher

When you run /usr/bin/code-server are you using the same user you use for systemctl start code-server@$user?

yes, the user are the same.

Are there any more logs? For example in the browser console or the output panel or in ~/.local/share/code-server/logs.

I have looked over the logs, it seems that there is no useful info.

Does this help at all? scalameta/metals#1627

I have read the above thread before submitting this issue.

Readon avatar Jun 22 '22 14:06 Readon

It might be difficult to debug without logs.

I tried this out in an Ubuntu 20.04.4 container but was not able to reproduce:

git clone https://github.com/Readon/SpinalHDL
curl -fsSL https://code-server.dev/install.sh | sh
sudo systemctl start code-server@$USER
  1. Open SpinalHDL in code-server
  2. Click "Import build" once it appears in a popup
  3. See Connected to Build server: Bloop v1.5.0-18-003e6c7b eventually in the output panel

Definitely strange that the systemd version does not work while running directly does. Could you share the systemd file?

code-asher avatar Jun 28 '22 18:06 code-asher