Unminimized OOM
See original GitHub issueWorking on minimizing this. Still a ways to go but I’m getting much closer. Please see this branch: https://github.com/djspiewak/cats-effect/tree/bug/dotty-compiler-oom You can reproduce the OOM by running sbt ++3.0.0-M3 kernelJVM/clean kernelJVM/compile
(ignore the errors; that code could just be deleted but I haven’t done it yet).
The offending call site appears to be this one: https://github.com/djspiewak/cats-effect/blob/bug/dotty-compiler-oom/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala#L33 If you uncomment the explicit type parameters, it compiles reasonably quickly. Forcing the compiler to make this inference for us (which 2.13 does just fine) causes it to spin its wheels for about a minute (on my laptop) before running out of memory.
Note that the import Resource._
and the implicit
in the companion object are also necessary. I haven’t minimized the other imports, but I suspect most of them are unneeded.
In case it’s helpful, I coaxed this stack trace out of it:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at scala.collection.immutable.List.$colon$colon(List.scala:97)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5070)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5102)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5080)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5105)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.op$proxy13$1(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5102)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5080)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5105)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.op$proxy13$1(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5102)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5080)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5105)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
at dotty.tools.dotc.core.Types$TypeMap.op$proxy13$1(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5067)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5102)
at dotty.tools.dotc.core.Substituters$.substParam(Substituters.scala:145)
at dotty.tools.dotc.core.Substituters$SubstParamMap.apply(Substituters.scala:193)
This reproduces against both M2 and M3.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I found the cause. It was a rather stupid mistake where we compared the wrong symbols. But all the real work was done by @griggt here.
It’s probably not fully minimized, but this self-contained example seems to trigger the issue: