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

unhandled exception while running pickler #21755

Open
peter-empen opened this issue Oct 11, 2024 · 6 comments · May be fixed by #21851
Open

unhandled exception while running pickler #21755

peter-empen opened this issue Oct 11, 2024 · 6 comments · May be fixed by #21851
Assignees
Labels
area:pickling itype:bug itype:crash regression This worked in a previous version but doesn't anymore

Comments

@peter-empen
Copy link

peter-empen commented Oct 11, 2024

Compiler version

any starting with 3.3.1 (3.3.0 works fine)

Minimized code

You may reproduce the issue by git clone https://github.com/scala-graph/scala-graph.git and in SBT

project core
++3.3.0
compile // success
++3.3.4!
compile // failure

Output (click arrows to expand)

tree def
error when pickling tree def root: GraphTraversal.this.NodeT
error when pickling tree [A >: Nothing <: Any,
  CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends
  GraphTraversal.this.FluentProperties[TraverserMethods.this.CC]() {
  this: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
  A
  +CC <: GraphTraversal.this.TraverserMethods[A, CC]
  def root: GraphTraversal.this.NodeT
  protected def nodeVisitor[U >: Nothing <: Any](f: A => U):
    GraphTraversal.this.NodeT => U
  protected def edgeVisitor[U >: Nothing <: Any](f: A => U):
    GraphTraversal.this.EdgeT => U
  final def withRoot(root: GraphTraversal.this.NodeT): TraverserMethods.this.CC
     =
    if this.root.eq(root) then this else 
      this.newTraverser.apply(root, this.parameters, this.subgraphNodes,
        this.subgraphEdges, this.ordering, this.maxWeight)
    ...(a lot more)
stack trace
  unhandled exception while running pickler on /home/peter/Graph4Scala/2.x/core/src/main/scala/scalax/collection/GraphTraversal.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose
  For non-enriched exceptions, compile with -Yno-enrich-error-messages.

     while compiling: /home/peter/Graph4Scala/2.x/core/src/main/scala/scalax/collection/GraphTraversal.scala
        during phase: pickler
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.14
    compiler version: version 3.3.4
            settings: -Wunused List(imports, privates) -classpath /home/peter/Graph4Scala/2.x/core/.jvm/target/scala-3.3.4/classes:/home/peter/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.4/scala3-library_3-3.3.4.jar:/home/peter/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalacheck/scalacheck_3/1.18.1/scalacheck_3-1.18.1.jar:/home/peter/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar:/home/peter/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar -d /home/peter/Graph4Scala/2.x/core/.jvm/target/scala-3.3.4/classes -deprecation true -feature true -language List(higherKinds)

[error] ## Exception when compiling 82 sources to /home/peter/Graph4Scala/2.x/core/.jvm/target/scala-3.3.4/classes
[error] java.lang.AssertionError: assertion failed: method root
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:327)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:580)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:372)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:372)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:606)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:336)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:582)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:372)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:372)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:606)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:336)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:582)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:372)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:372)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:622)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:816)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:814)
[error] dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:90)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:84)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.transform.Pickler.run(Pickler.scala:83)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:336)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:333)
[error] dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:151)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:308)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:349)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:358)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:358)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:261)
[error] dotty.tools.dotc.Run.compile(Run.scala:246)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:196)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:251)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:186)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:166)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:241)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:166)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:214)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$3(Incremental.scala:178)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$3$adapted(Incremental.scala:176)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:454)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:117)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:265)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:409)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:496)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:396)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:170)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2427)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2377)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:41)
[error] sbt.internal.io.Retry$.apply(Retry.scala:47)
[error] sbt.internal.io.Retry$.apply(Retry.scala:29)
[error] sbt.internal.io.Retry$.apply(Retry.scala:24)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:41)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2375)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] sbt.Execute.work(Execute.scala:292)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] java.base/java.lang.Thread.run(Thread.java:829)
@peter-empen
Copy link
Author

peter-empen commented Oct 11, 2024

how would you get a list of PRs/commits that changed the pickler after 3.3.0 and were released in 3.3.1?

@KacperFKorban
Copy link
Member

@peter-empen You can probably just look at the git history of Pickler.scala
But I think that it would be easier to try to minimize your crash into a self-contained example.

@Gedochao Gedochao added area:pickling and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 16, 2024
@peter-empen
Copy link
Author

Hey Kacper, I was able to boil it down to the following:

trait GraphTraversal  {
  type NodeT

  protected trait Properties {
    def root: NodeT
  }

  abstract protected class TraverserMethods[A, +CC <: TraverserMethods[A, CC]]  { this: CC with Properties =>
    def root: NodeT
  }
}

@prolativ prolativ added regression This worked in a previous version but doesn't anymore and removed stat:needs minimization Needs a self contained minimization labels Oct 21, 2024
@prolativ
Copy link
Contributor

Trying to bisect that. The regression seems to have happened somewhere between 3.3.1-RC1-bin-20230215-006e2e4-NIGHTLY and 3.3.1-RC1-bin-20230216-2507577-NIGHTLY

@prolativ
Copy link
Contributor

Bisected further with scala-cli project/scripts/bisect.scala -- --bootstrapped --releases 3.3.1-RC1-bin-20230215-006e2e4-NIGHTLY...3.3.1-RC1-bin-20230216-2507577-NIGHTLY compile /tmp/bisect/GraphTraversal.scala.
This points to c830ad2

@Gedochao
Copy link
Contributor

cc @odersky

@odersky odersky self-assigned this Oct 28, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue Oct 28, 2024
It turns out it could have the wrong symbol referring to a same-named definition
in the superclass under some recursive definition of a self type. This caused a crash
in pickler in scala#21755 because we now have two different definitions in two different classes that
have the same symbol.

Fixes scala#21755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pickling itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants