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

Second stab at 2.12.4. #477

Merged
merged 2 commits into from
Dec 7, 2017
Merged

Second stab at 2.12.4. #477

merged 2 commits into from
Dec 7, 2017

Conversation

olafurpg
Copy link
Contributor

@olafurpg olafurpg commented Dec 5, 2017

Last time we upgraded to 2.12.4 the CI failed with a missing shapeless
implicit error from case-app. I can reproduce this error locally only on
the first sbt compile. Running the command the seconds time succeeds
compilation. I want to see if CI fails again, and investigate if
-YdisableFlatCpCaching can fix the error.

EDIT, -YdisableFlatCpCaching did not seem to fix the error. Let me try and remove ArgParserImplicits.

Last time we upgraded to 2.12.4 the CI failed with a missing shapeless
implicit error from case-app. I can reproduce this error locally only on
the first `sbt compile`. Running the command the seconds time succeeds
compilation. I want to see if CI fails again, and investigate if
`-YdisableFlatCpCaching` can fix the error.
@olafurpg olafurpg force-pushed the 2.12.4 branch 2 times, most recently from 3e13f0c to 620c630 Compare December 7, 2017 13:47
@olafurpg
Copy link
Contributor Author

olafurpg commented Dec 7, 2017

cc/ @alexarchambault have you experienced issues resolving case-app/shapeless implicits when upgrading to 2.12.4? The error is

[error] /home/travis/build/scalacenter/scalafix/scalafix-cli/src/main/scala/scalafix/internal/cli/ArgParserImplicits.scala:14: could not find implicit value for parameter parser: caseapp.core.Parser[scalafix.internal.cli.ScalafixOptions]
[error]   val OptionsParser: Parser[ScalafixOptions] = Parser.apply[ScalafixOptions]
[error]                    

Full log: https://travis-ci.org/scalacenter/scalafix/jobs/312965607#L660

Most notably, the cli module compiled fine right before https://travis-ci.org/scalacenter/scalafix/jobs/312965607#L605 but the implicit resolution fails because of custom settings for scripted

    publishLocal := publishLocal
      .dependsOn(
        publishLocal in diff212JVM,
        publishLocal in core212JVM,
        publishLocal in reflect212,
        publishLocal in cli212)
      .value,

It's quite tricky to reproduce locally, but I think I've validated that the error is not caused by scaladoc. My best guess is that it's related to shapeless.Lazy and running concurrent aggregated tasks via sbt. I have never experienced any problems with this before, however, it only started in 2.12.4.

@alexarchambault
Copy link

@olafurpg Nothing specific to 2.12.4. But I remember having manually written some Parser in the past, because their derivation was failing for no obvious reason. I haven't investigated more than that…

With -Xlog-implicits I was able to track down that the inductive
derivation for the case-app parser was failing with a stack overflow
```
[info] hasMatchingSymbol reported error: exception during macro expansion:
[info] java.lang.StackOverflowError
[info]     at scala.tools.nsc.typechecker.StdAttachments.isMacroImplRef(StdAttachments.scala:153)
[info]     at scala.tools.nsc.typechecker.StdAttachments.isMacroImplRef$(StdAttachments.scala:153)
[info]     at scala.tools.nsc.Global$$anon$1.isMacroImplRef(Global.scala:458)
[info]     at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1175)
```

This could offer an explanation why 2.12.4 is a regression, since the
stack size might have changed.
@olafurpg
Copy link
Contributor Author

olafurpg commented Dec 7, 2017

Thanks @alexarchambault

I debugged the issue with -Xlog-implicits and that revealed a stack overflow error

[info]  [E518] scalafix-cli/src/main/scala/scalafix/internal/cli/ArgParserImplicits.scala
[info]         shapeless.this.Strict.mkStrict is not a valid implicit value for shapeless.Strict[caseapp.core.HListParser.Aux[Int with shapeless.labelled.KeyTag[Symbol with shapeless.tag.Tagged[String("stackVerbosity")],Int] :: shapeless.HNil,Option[Int] :: shapeless.HNil,scala.collection.immutable.Nil.type :: shapeless.HNil,None.type :: shapeless.HNil,None.type :: shapeless.HNil,Some[caseapp.Hidden] :: shapeless.HNil,None.type :: shapeless.HNil,PT]] because:
[info]         hasMatchingSymbol reported error: exception during macro expansion:
[info]         java.lang.StackOverflowError
[info]         	at scala.tools.nsc.typechecker.StdAttachments.isMacroImplRef(StdAttachments.scala:153)
[info]         	at scala.tools.nsc.typechecker.StdAttachments.isMacroImplRef$(StdAttachments.scala:153)

I bumped up the stack size in .jvmopts and it seems to have fixed the issue. Someone is catching fatal errors in the compiler 😭

Happy we can at least we can upgrade and 2.12.4 is not to blame 😄

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

Successfully merging this pull request may close these issues.

2 participants