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

My student's project complete crash and burn with Metals and VSCode #4837

Closed
soronpo opened this issue Jan 10, 2023 · 5 comments
Closed

My student's project complete crash and burn with Metals and VSCode #4837

soronpo opened this issue Jan 10, 2023 · 5 comments

Comments

@soronpo
Copy link

soronpo commented Jan 10, 2023

Describe the bug

I'll first say I'm not here to whine about metals/bloop. The current state of Scala tooling is waaaaaaay better than where I started. But when I (and my students) try to use metals, we hit so many issues that I'm just giving up and using sbt in terminal directly.
I opened this issue to continue the discussion with @ckipp01 from
https://contributors.scala-lang.org/t/revisiting-the-default-build-server-for-metals-roadmap/6054

I took it upon myself to no longer sweep the bugs under the carpet and try to report as much as I can.
Here is a recent log from my student's project. I edited it a little and removed identifying information.
I can send a zip file with the project privately, but it is still difficult to replicate issues that happen during regular project usage.
metals.log

What can we do to help finally isolate and fix these issues?

Expected behavior

No response

Operating system

Windows

Editor/Extension

VS Code

Version of Metals

0.11.9

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Jan 10, 2023

Thanks for reporting! I will take a look through the logs, but I see that they managed to find a wealth of issues while using Metals 😨

  • first one is an issue with broken shading, but fortunately this is handled and just logged by Metals:
SEVERE: assertion failed: coursierapi.shaded.coursier.package$. already has a symbol
java.lang.AssertionError: assertion failed: coursierapi.shaded.coursier.package$. already has a symbol
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.SymbolLoaders$.enterNew(SymbolLoaders.scala:42)
	at dotty.tools.dotc.core.SymbolLoaders$.enterClass(SymbolLoaders.scala:53)
	at dotty.tools.dotc.core.SymbolLoaders$.enterClassAndModule(SymbolLoaders.scala:104)
	at dotty.tools.dotc.core.classfile.ClassfileParser.enterClassAndModule$1(ClassfileParser.scala:865)
	at dotty.tools.dotc.core.classfile.ClassfileParser.enterOwnInnerClasses$$anonfun$1(ClassfileParser.scala:873)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
2023.01.02 17:31:25 WARN  Error downloading ch.epfl.scala:scala-expression-compiler_3.2.2-RC1:2.2.0
  not found: C:\Users\student\.ivy2\local\ch.epfl.scala\scala-expression-compiler_3.2.2-RC1\2.2.0\ivys\ivy.xml
  not found: https://repo1.maven.org/maven2/ch/epfl/scala/scala-expression-compiler_3.2.2-RC1/2.2.0/scala-expression-compiler_3.2.2-RC1-2.2.0.pom
2023.01.02 17:31:25 WARN  Expression evaluation will not work.
2023.01.02 17:31:25 INFO  tracing is disabled for protocol dap-server, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\dfiant-template\.metals\dap-server.trace.json or C:\Users\student\AppData\Local\scalameta\metals\cache\dap-server.trace.json
2023.01.02 17:31:27 INFO  tracing is disabled for protocol dap-client, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\dfiant-template\.metals\dap-client.trace.json or C:\Users\student\AppData\Local\scalameta\metals\cache\dap-client.trace.json
2023.01.02 17:31:27 INFO  Starting debug proxy for [hello]
2023.01.02 17:31:29 WARN  Error downloading ch.epfl.scala:scala-expression-compiler_3.2.2-RC1:2.2.0
  not found: C:\Users\student\.ivy2\local\ch.epfl.scala\scala-expression-compiler_3.2.2-RC1\2.2.0\ivys\ivy.xml
  not found: https://repo1.maven.org/maven2/ch/epfl/scala/scala-expression-compiler_3.2.2-RC1/2.2.0/scala-expression-compiler_3.2.2-RC1-2.2.0.pom
2023.01.02 17:31:29 WARN  Expression evaluation will not work.
2023.01.02 17:31:29 INFO  tracing is disabled for protocol dap-server, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\dfiant-template\.metals\dap-server.trace.json or C:\Users\student\AppData\Local\scalameta\metals\cache\dap-server.trace.json
2023.01.02 17:31:29 INFO  tracing is disabled for protocol dap-client, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\dfiant-template\.metals\dap-client.trace.json or C:\Users\student\AppData\Local\scalameta\metals\cache\dap-client.trace.json
2023.01.02 17:31:29 INFO  Starting debug proxy for [hello]
2023.01.02 17:31:29 ERROR java.nio.file.FileSystemAlreadyExistsException
2023.01.02 17:31:29 INFO  Closing debug server tcp://0.0.0.0:58969
java.lang.AssertionError: NoDenotation.owner
	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2511)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:190)
	at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1657)
	at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1657)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1621)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1535)
	at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1658)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:178)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$1(ExtractSemanticDB.scala:142)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:142)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$1(ExtractSemanticDB.scala:142)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:142)
	at scala.meta.internal.pc.SemanticdbTextDocumentProvider.textDocument(SemanticdbTextDocumentProvider.scala:39)
  • index out of bounds error -> clear bug on Metals side (should be fixed in the next release)
SEVERE: String index out of range: 1278
java.lang.StringIndexOutOfBoundsException: String index out of range: 1278
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at scala.collection.StringOps$.apply$extension(StringOps.scala:188)
	at scala.meta.internal.pc.PcCollector.adjust(PcCollector.scala:66)
	at scala.meta.internal.pc.PcDocumentHighlightProvider.collect(PcDocumentHighlightProvider.scala:18)
	at scala.meta.internal.pc.PcDocumentHighlightProvider.collect(PcDocumentHighlightProvider.scala:17)
	at scala.meta.internal.pc.PcCollector.collectNames$1(PcCollector.scala:257)
	at scala.meta.internal.pc.PcCollector.$anonfun$10(PcCollector.scala:349)
	at dotty.tools.dotc.ast.Trees$Instance$DeepFolder.apply(Trees.scala:1663)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1621)
	at dotty.tools.dotc.ast.Trees$Instance$DeepFolder.apply(Trees.scala:1663)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.fold$1(Trees.scala:1529)
SEVERE: NoDenotation.owner
java.lang.AssertionError: NoDenotation.owner
	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2511)
	at scala.meta.internal.pc.printer.MetalsPrinter.completionSymbol(MetalsPrinter.scala:121)
	at scala.meta.internal.pc.completions.CompletionValue$Symbolic.description(CompletionValue.scala:89)
	at scala.meta.internal.pc.completions.CompletionValue$Symbolic.description$(CompletionValue.scala:46)
	at scala.meta.internal.pc.completions.CompletionValue$Workspace.description(CompletionValue.scala:98)
	at scala.meta.internal.pc.completions.CompletionProvider.completionItems(CompletionProvider.scala:179)
	at scala.meta.internal.pc.completions.CompletionProvider.$anonfun$1(CompletionProvider.scala:97)
	at scala.collection.immutable.List.map(List.scala:250)
	at scala.meta.internal.pc.completions.CompletionProvider.completions(CompletionProvider.scala:98)
java.lang.AssertionError: assertion failed
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
	at dotty.tools.dotc.util.Spans$Span$.point$extension(Spans.scala:57)
	at scala.meta.internal.pc.PcCollector.isForComprehensionOwner$1$$anonfun$3(PcCollector.scala:226)
	at scala.collection.immutable.Set$Set2.exists(Set.scala:204)
	at scala.meta.internal.pc.PcCollector.isForComprehensionOwner$1(PcCollector.scala:226)
	at scala.meta.internal.pc.PcCollector.collectNames$1(PcCollector.scala:252)
	at scala.meta.internal.pc.PcCollector.$anonfun$11(PcCollector.scala:357)
	at dotty.tools.dotc.ast.Trees$Instance$DeepFolder.apply(Trees.scala:1663)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1542)
	at dotty.tools.dotc.ast.Trees$Instance$DeepFolder.apply(Trees.scala:1663)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1548)
	at dotty.tools.dotc.ast.Trees$Instance$DeepFolder.apply(Trees.scala:1663)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.fold$1(Trees.scala:1529)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.apply(Trees.scala:1531)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1548)
  • issue with workspace and spaces, which I broke trying to fix another issue with windows, but it is since fixed. I will try to release a new version sooner because of that:
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 89: file:///c:/dfiant-template/src/main/scala/BramSdp copy.scala
	at java.base/java.net.URI.create(URI.java:883)
	at scala.meta.internal.mtags.MtagsEnrichments$XtensionStringMtags.toAbsolutePath(MtagsEnrichments.scala:158)
	at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:609)
	at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:606)
  • issue with Scalameta (would be great to see the snippet that broke) looks like a flake, might have been broken code. I wasn't able to reproduce but instead decided to catch the exception since most likely this was a broken code anyway bugfix: Catch StackOverflowException from the parser #4902
Caused by: java.lang.StackOverflowError
	at scala.meta.internal.prettyprinters.TokenToString$.apply(TokenToString.scala:9)
	at scala.meta.tokens.Token$KwCase.toString(Token.scala:54)
	at scala.meta.internal.parsers.SoftKeywords$KwExtension$.unapply(SoftKeywords.scala:89)
	at scala.meta.internal.parsers.SoftKeywords$KwExtension$$anon$10.apply(SoftKeywords.scala:85)
	at scala.meta.internal.parsers.SoftKeywords$KwExtension$$anon$10.apply(SoftKeywords.scala:85)
	at scala.meta.classifiers.Api$XtensionClassifiable.is(Api.scala:7)
	at scala.meta.internal.parsers.ScannerTokens$Classifiers$KwExtension$.unapply(ScannerTokens.scala:266)
	at scala.meta.internal.parsers.ScalametaParser.defOrDclOrSecondaryCtor(ScalametaParser.scala:3381)
	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3721)
	at scala.meta.internal.parsers.ScalametaParser.defOrDclOrSecondaryCtor(ScalametaParser.scala:3397)
	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3721)
	at scala.meta.internal.parsers.ScalametaParser.defOrDclOrSecondaryCtor(ScalametaParser.scala:3397)
	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3721)
	at scala.meta.internal.parsers.ScalametaParser.defOrDclOrSecondaryCtor(ScalametaParser.scala:3397)
	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3721)
	at scala.meta.internal.parsers.ScalametaParser.defOrDclOrSecondaryCtor(ScalametaParser.scala:3397)
	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3721)

I also see an error with troubles to load jars required by Metals or bsp server, did the student clear their caches at some point? This might sometimes break more than fixed.

Most of that we should be able to fix, sorry about the issues :/

@soronpo
Copy link
Author

soronpo commented Jan 10, 2023

I also see an error with troubles to load jars required by Metals or bsp server, did the student clear their caches at some point? This might sometimes break more than fixed.

This may be due to my attempt of using the student's project on my computer to see if I also experience bugs

@ritschwumm
Copy link

looks like this is using a release candidate of scala, maybe going back to the last real release helps?

ckipp01 added a commit to ckipp01/scala-debug-adapter that referenced this issue Jan 25, 2023
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 25, 2023
For scalameta#4837

There are some other places that access span, but most of them seem safe.
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 25, 2023
Previously, the exception could break anthing trying to use Trees and since it's an error in the parser we shouldn't break metals. Now, we catch the exception instead and print the code it failed on.

Related to scalameta#4837
adpi2 pushed a commit to scalacenter/scala-debug-adapter that referenced this issue Jan 26, 2023
tgodzik added a commit that referenced this issue Jan 26, 2023
For #4837

There are some other places that access span, but most of them seem safe.
@tgodzik
Copy link
Contributor

tgodzik commented Feb 8, 2023

Ok I think I tackled most issues, I will close this one, we can reopen when another set of issues appears.

@tgodzik tgodzik closed this as completed Feb 8, 2023
@soronpo
Copy link
Author

soronpo commented Feb 8, 2023

@tgodzik Thank you very much for doing this!

tgodzik added a commit that referenced this issue Feb 9, 2023
Previously, the exception could break anthing trying to use Trees and since it's an error in the parser we shouldn't break metals. Now, we catch the exception instead and print the code it failed on.

Related to #4837
@tgodzik tgodzik added this to the Metals v0.11.11 milestone Mar 2, 2023
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

3 participants