Skip to content

Crash cascade from compiler stack trace #2545

Open
@pawelprazak

Description

@pawelprazak

Version(s)
scala-cli 1.0.5
Scala 3.3.1
JVM 21

scala-cli bloop about
bloop v1.5.11-sc-2

Using Scala v2.12.18 and Zinc v1.9.3
Running on Java JDK v21.0.1 (/opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home)
  -> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center and the community.

Describe the bug
I'm using scala-cli from IntelliJ through BSP.

scala-cli hangs trying to compile (reproduced by running scala-cli from shell)

After attempts to reconnect and after a long time (way longer then the mentioned 30 sec) the output is:

Deduplicating compilation of core_eb3cc40819 from bsp client 'scala-cli 1.0.5' (since 26m 1.426s)
Disconnecting from deduplication of ongoing compilation for 'core_eb3cc40819'
No progress update for 30 seconds caused bloop to cancel compilation and schedule a new compile.
Nov 14, 2023 3:37:28 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 1

Bloop reports a nailgun exception and ignores multiple SIGINTs

Bloop server PID: 8372
Ignoring SIGINT
Will truncate output file /Users/pprazak/Library/Caches/ScalaCli/bloop/daemon/output every 5 minutes
Unable to load nailgun-version.properties.
NGServer [UNKNOWN] started on local socket /Users/pprazak/Library/Caches/ScalaCli/bloop/daemon/socket.
Nov 14, 2023 2:05:52 PM zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Spans were dropped due to exceptions. All subsequent errors will be logged at FINE level.
Nov 14, 2023 2:05:52 PM zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Dropped 1 spans due to ConnectException(Connection refused)
java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
	at java.base/java.net.Socket.connect(Socket.java:751)
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:531)
	...
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1417)
	at zipkin2.reporter.urlconnection.URLConnectionSender.send(URLConnectionSender.java:229)
	...
	at zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:266)
	at bloop.tracing.BraveTracer$.$anonfun$apply$5(BraveTracer.scala:178)
	at bloop.tracing.BraveTracer.terminate(BraveTracer.scala:105)
	at bloop.engine.tasks.CompileTask$.$anonfun$compile$32(CompileTask.scala:337)
	...
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Then it reports a compiler crash:

  unhandled exception while running inlining on /Users/pprazak/repos/besom/core/src/main/scala/besom/internal/Resource.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: <no file>
        during phase: <no phase>
                mode: Mode(ImplicitsEnabled,ReadPositions)
     library version: version 2.13.10
    compiler version: version 3.3.1
            settings: ...

                tree: EmptyTree
       tree position: :<unknown>
           tree type: <notype>
              symbol: val <none>
           call site: package <root> in module class <root>

  == Source file context for tree position ==


java.lang.NoClassDefFoundError: besom/internal/Context
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578)
	at java.base/java.lang.Class.getMethodsRecursive(Class.java:3719)
	at java.base/java.lang.Class.getMethod0(Class.java:3705)
	at java.base/java.lang.Class.getMethod(Class.java:2393)
	at dotty.tools.dotc.quoted.Interpreter.getMethod(Interpreter.scala:219)
	at dotty.tools.dotc.quoted.Interpreter.interpretedStaticMethodCall(Interpreter.scala:171)
	at dotty.tools.dotc.quoted.Interpreter.interpretTree(Interpreter.scala:80)
	at dotty.tools.dotc.transform.Splicer$SpliceInterpreter.interpretTree(Splicer.scala:258)
	at dotty.tools.dotc.quoted.Interpreter.interpretTree$$anonfun$2(Interpreter.scala:99)
	at dotty.tools.dotc.transform.Splicer$.$anonfun$2(Splicer.scala:60)
	at scala.Option.fold(Option.scala:263)
	at dotty.tools.dotc.transform.Splicer$.splice(Splicer.scala:60)
	at dotty.tools.dotc.inlines.Inliner.dotty$tools$dotc$inlines$Inliner$$expandMacro(Inliner.scala:1048)
	at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedSplice(Inliner.scala:839)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3092)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
	at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:915)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
	at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:65)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3053)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
	at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:915)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
	at dotty.tools.dotc.inlines.Inliner.inlined(Inliner.scala:681)
	at dotty.tools.dotc.inlines.Inlines$InlineCall.expand(Inlines.scala:444)
	at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:152)
	at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:95)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1567)
	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
	at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:89)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1244)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1244)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1246)
	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:58)
	at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:108)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1572)
	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
	at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:89)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1244)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1244)
	at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1246)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1580)
	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
	at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:97)
	at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:58)
	at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:18)
	at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:34)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:250)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:38)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileSources(Run.scala:194)
	at dotty.tools.dotc.Run.compile(Run.scala:179)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:133)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$7(BloopHighLevelCompiler.scala:155)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:71)
	at bloop.tracing.BraveTracer.traceInternal(BraveTracer.scala:67)
	at bloop.tracing.BraveTracer.trace(BraveTracer.scala:41)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:70)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$6(BloopHighLevelCompiler.scala:155)
	...
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: java.lang.ClassNotFoundException: besom.internal.Context
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	... 91 more

The crash repeats multiple times. I've attached the full log file.
crash.log

To Reproduce
This might be hard to reproduce.

This issue was observed when compiling this code, with:

scala-cli compile core

Expected behaviour
scala-cli should not hang and give more useful and actionable information about the issues:

  • should report that the compiler has crashed multiple times
  • should suggest using scala-cli bloop output to get diagnostic information
  • should suggest to file a bug report

Also dotty should not crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BloopIssues tied with Bloop integration.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions