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

Regression SpaceEngine wrt 3.3.0 #19433

Closed
Adam-Vandervorst opened this issue Jan 12, 2024 · 9 comments · Fixed by #19634
Closed

Regression SpaceEngine wrt 3.3.0 #19433

Adam-Vandervorst opened this issue Jan 12, 2024 · 9 comments · Fixed by #19634
Labels
area:transform exp:advanced itype:bug itype:crash Spree Suitable for a future Spree stat:needs minimization Needs a self contained minimization
Milestone

Comments

@Adam-Vandervorst
Copy link

Adam-Vandervorst commented Jan 12, 2024

3.3.1

Minimized code

running compile on
https://github.com/Adam-Vandervorst/CZ2

Output (click arrow to expand)

[info] compiling 13 Scala sources to /home/adam/IdeaProjects/CZ2/jvm/target/scala-3.3.1/classes ...
  unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on /home/adam/IdeaProjects/CZ2/shared/src/main/scala/ExprMap.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)
     library version: version 2.13.10
    compiler version: version 3.3.1
            settings: -bootclasspath /home/adam/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar:/home/adam/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar -classpath /home/adam/IdeaProjects/CZ2/jvm/target/scala-3.3.1/classes -d /home/adam/IdeaProjects/CZ2/jvm/target/scala-3.3.1/classes

                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 ==
error] ## Exception when compiling 14 sources to /home/adam/IdeaProjects/CZ2/jvm/target/scala-3.3.1/classes
[error] java.lang.StackOverflowError
[error] dotty.tools.dotc.core.Types$Type.findMember(Types.scala:886)
[error] dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:678)
[error] dotty.tools.dotc.core.Types$Type.member(Types.scala:662)
[error] dotty.tools.dotc.typer.Applications$.extractorMember(Applications.scala:44)
[error] dotty.tools.dotc.typer.Applications$.extractorMemberType(Applications.scala:47)
[error] dotty.tools.dotc.typer.Applications$.$anonfun$42(Applications.scala:113)
[error] dotty.tools.dotc.typer.Applications$.$anonfun$adapted$3(Applications.scala:113)
[error] scala.collection.Iterator$$anon$9.next(Iterator.scala:584)
[error] scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:637)
[error] scala.collection.immutable.List.prependedAll(List.scala:152)
[error] scala.collection.IterableOnceOps.toList(IterableOnce.scala:1288)
[error] scala.collection.IterableOnceOps.toList$(IterableOnce.scala:1288)
[error] scala.collection.AbstractIterator.toList(Iterator.scala:1300)
[error] dotty.tools.dotc.typer.Applications$.productSelectorTypes(Applications.scala:114)
[error] dotty.tools.dotc.transform.patmat.SpaceEngine$.isCheckable$1(Space.scala:845)
[error] dotty.tools.dotc.transform.patmat.SpaceEngine$.isCheckable$1$$anonfun$1(Space.scala:845)
[error] scala.collection.immutable.List.exists(List.scala:395)
(last three lines repeated)

Note

It doesn't crash on 3.3.0

@Adam-Vandervorst Adam-Vandervorst added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 12, 2024
@Adam-Vandervorst Adam-Vandervorst changed the title Crash not touching project? Regression SpaceEngine wrt 3.3.0-RC6 Jan 12, 2024
@Adam-Vandervorst Adam-Vandervorst changed the title Regression SpaceEngine wrt 3.3.0-RC6 Regression SpaceEngine wrt 3.3.0 Jan 12, 2024
@jchyb jchyb added area:transform stat:needs minimization Needs a self contained minimization and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 15, 2024
@Gedochao
Copy link
Contributor

@Adam-Vandervorst can you help to minimise the code for the replication of this crash?

@Adam-Vandervorst
Copy link
Author

Since the error doesn't show a single call originating from the project, I am still trying to figure out where to start.
Do you have any pointers?

@Adam-Vandervorst
Copy link
Author

Adam-Vandervorst commented Jan 18, 2024

The project is quite "low-tech" Scala. It doesn't use any imports or any fancy type constructions (I learned my lesson with #15992). Nonetheless, there are some things one of you may recognize as suspicious, together with the changes made from 3.3.0 to 3.3.1.
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/utils.scala#L19
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/utils.scala#L28
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/utils.scala#L31
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/ExprMapEngine.scala#L58
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/evaluation.scala#L39
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/ExprMap.scala#L47
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/ExprMap.scala#L328
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/ExprMap.scala#L129
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/Expr.scala#L239
https://github.com/Adam-Vandervorst/CZ2/blob/aaa8aa58173df13996fb31fcfc182ba158d4681f/shared/src/main/scala/RangeStorage.scala#L15

@Gedochao
Copy link
Contributor

Since the error doesn't show a single call originating from the project, I am still trying to figure out where to start.
Do you have any pointers?

@Adam-Vandervorst as much as I'd like to help, not really.

     while compiling: <no file>
        during phase: <no phase>

we don't know the particular file or phase.

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

the output we see here doesn't give virtually anything to go on, as far as I can tell.

What I imagine minimising this issue would entail is to take a look at your whole build and try to strip it of code while checking if the issue is replicable to try to pinpoint on where is the cause.
We need a snippet of code which would allow to replicate it.
As this would require some understanding of your project, it's likely that you are in the best position to try it.
I wish I could give you any better pointers here, but there's just not much to go on here.

https://github.com/lampepfl/dotty/blob/release-3.3.1/compiler/src/dotty/tools/dotc/core/Types.scala#L886
I believe the stack overflow happens on this recursive call, but this doesn't tell a whole lot, either (to me at the very least it doesn't).

Of course, we won't ignore this, as it's evidently a compiler crash and seems like a possible regression, but thorough investigation on the compiler team's side may take time.
Let me know if I can help.

@Adam-Vandervorst
Copy link
Author

we don't know the particular file or phase.

Out of curiosity, what could've caused this info to be unavailable?

@SethTisue
Copy link
Member

Just checking: is it the same on 3.4.0-RC2?

@Gedochao
Copy link
Contributor

Gedochao commented Jan 22, 2024

unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on /home/adam/IdeaProjects/CZ2/shared/src/main/scala/ExprMap.scala

Actually I haven't noticed earlier, but it seems we do know the exact file it breaks on: /home/adam/IdeaProjects/CZ2/shared/src/main/scala/ExprMap.scala

I suppose there's a separate bug in crash reporting, as the rest of the log doesn't point anywhere concrete.
We'll be able to extract that to a separate issue when we're able to minimise this.

Based on that, the megaphase seems to be this: https://github.com/lampepfl/dotty/blob/721e7c87ee95b811984b7b992728729d7094c4c4/compiler/src/dotty/tools/dotc/Compiler.scala#L75-L83
@Adam-Vandervorst I hope that narrows it down at least a little bit

@Adam-Vandervorst
Copy link
Author

@SethTisue yes, it also crashes on 3.4.0-RC2.

@Gedochao thanks, I'll try and surface some of the suspicious pattern matching in that file, or try and comment it out.

@mbovel mbovel added exp:advanced Spree Suitable for a future Spree labels Jan 31, 2024
@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 42 of February 6th, 2024. @dwijnand, @EugeneFlesselle, @jan-pieter will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:transform exp:advanced itype:bug itype:crash Spree Suitable for a future Spree stat:needs minimization Needs a self contained minimization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants