Skip to content

Dotty Repl OOM's on one-liner input #10983

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

Closed
emilypi opened this issue Jan 3, 2021 · 5 comments · Fixed by #10985
Closed

Dotty Repl OOM's on one-liner input #10983

emilypi opened this issue Jan 3, 2021 · 5 comments · Fixed by #10985
Milestone

Comments

@emilypi
Copy link

emilypi commented Jan 3, 2021

Minimized code

scala> val I1: Int = 0 * * * 8 * 1 - 1 + 1 +                                    

Output

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
	at scala.runtime.IntRef.create(IntRef.java:22)
	at dotty.tools.dotc.ast.Trees$Tree.treeSize(Trees.scala:182)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$2(Trees.scala:184)
	at dotty.tools.dotc.ast.Trees$Tree.treeSize$$anonfun$1(Trees.scala:188)
	at dotty.tools.dotc.ast.Trees$Tree$$Lambda$786/1712635211.applyVoid(Unknown Source)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1279)
	at dotty.tools.dotc.ast.Trees$Tree.treeSize(Trees.scala:188)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$2(Trees.scala:184)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$1$$anonfun$1(Trees.scala:185)
	at dotty.tools.dotc.ast.Trees$Tree$$Lambda$853/2081703861.applyVoid(Unknown Source)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$2(Trees.scala:185)
	at dotty.tools.dotc.ast.Trees$Tree.treeSize$$anonfun$1(Trees.scala:188)
	at dotty.tools.dotc.ast.Trees$Tree$$Lambda$786/1712635211.applyVoid(Unknown Source)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1279)
	at dotty.tools.dotc.ast.Trees$Tree.treeSize(Trees.scala:188)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$2(Trees.scala:184)
	at dotty.tools.dotc.ast.Trees$Tree.addSize$1$$anonfun$1(Trees.scala:185)
	at dotty.tools.dotc.ast.Trees$Tree$$Lambda$853/2081703861.applyVoid(Unknown Source)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)

Expectation

REPL does not OOM.

For more information, see: #9344.

@emilypi
Copy link
Author

emilypi commented Jan 3, 2021

For context, this is a stock Dotty install, installed via brew on the following laptop:

Model Name:	MacBook Pro
  Model Identifier:	MacBookPro14,3
  Processor Name:	Quad-Core Intel Core i7
  Processor Speed:	3.1 GHz
  Number of Processors:	1
  Total Number of Cores:	4
  L2 Cache (per Core):	256 KB
  L3 Cache:	8 MB
  Hyper-Threading Technology:	Enabled
  Memory:	16 GB
  System Firmware Version:	429.60.3.0.0

@odersky
Copy link
Contributor

odersky commented Jan 3, 2021

@emilipy Some programs OOM. This one is particularly short. That has curiosity value, but is not by itself a bug. If you want to help, it would be good to try to get to the bottom why there is a OOM, and whether that's something that can be fixed.

@emilypi
Copy link
Author

emilypi commented Jan 4, 2021

@odersky Interesting take! Unfortunately, I am not the one to assign this to, as I have no free time to look at this within anything resembling a meaningful time frame. However, if you wanted, I'm sure @hrhino would love to attack this :)

@emilypi emilypi removed their assignment Jan 4, 2021
@odersky
Copy link
Contributor

odersky commented Jan 4, 2021

@emilypi It's fine. I had another look. The root cause is that errors get propagated too far. They should truncate implicit searches but don't do it sufficiently well. The compiler is very lenient in that it does not report a type mismatch error if some participant is already erroneous. That's good to cut down on noise. But it also means that implicit searches can get out of hand, because too much is eligible.

@emilypi
Copy link
Author

emilypi commented Jan 10, 2021

Thanks for looking into that @odersky

@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants