Skip to content

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

Closed

Description

@soronpo

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

Activity

  1. tgodzik commented on Jan 10, 2023

    @tgodzik
    Contributor

    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 :/

  2. soronpo commented on Jan 10, 2023

    @soronpo
    Author

    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

  3. ritschwumm commented on Jan 11, 2023

    @ritschwumm

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

  4. added a commit that references this issue on Jan 26, 2023
  5. added a commit that references this issue on Jan 26, 2023
  6. tgodzik commented on Feb 8, 2023

    @tgodzik
    Contributor

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

  7. soronpo commented on Feb 8, 2023

    @soronpo
    Author

    @tgodzik Thank you very much for doing this!

  8. added this to the Metals v0.11.11 milestone on Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions