scala / scala-dev

Scala 2 team issues. Not for user-facing bugs or directly actionable user-facing improvements. For build/test/infra and for longer-term planning and idea tracking. Our bug tracker is at https://github.com/scala/bug/issues
Apache License 2.0
130 stars 15 forks source link

Allocation tests in scala/scala fail on JDK 19 #828

Closed SethTisue closed 1 year ago

SethTisue commented 1 year ago

reproducible with partest test/files/run/small-seq-apply.scala (perhaps other tests are affected as well?)

what's weird is that it succeeds again on JDK 20 early-access (20-ea+31-2311)

reported by @AminMal on Discord. @som-snytt was already aware

som-snytt commented 1 year ago

wide eyes because Seth is like, You need to use a real JDK like 20-ea+31-2311.

SethTisue commented 1 year ago

LTS stands for Losers That are Scared (to live on the edge)

som-snytt commented 1 year ago

Love Tormenting Seth with jdk version issues.

som-snytt commented 1 year ago

I am way behind the curve 21.ea.6-open.

AminMal commented 1 year ago

perhaps other tests are affected as well?

Other partests were fine on java 8 and 11, not sure about other versions.

som-snytt commented 1 year ago

I was about to certify JDK 20 but the large list test in the junit test just failed, with the loop count boosted to 10K.

The allocation metric falls 336, 296, by 40 instead of 16. What is size 40? 16 + 3*8.

Apparently, my comment in the partest was:

restored partest (cf junit) to test outside scala.collection package

but the "large" test is commented out, possibly for no particular reason. I remember that the test was for the rewrite in cleanup, which is why the test needed to be compiled in a neutral package, but a junit test could also be assigned an arbitrary package; the other reason to use partest is that it's testing compiler behavior.

I also remember lrytz commenting that it could or ought to be a BytecodeTest or BytecodeTesting. That is, there is a more direct way to check the behavior than measuring for side effects.

Similar result on JDK 21.

[error] Test scala.collection.immutable.ListAllocationTest.largeListAllocation failed: java.lang.AssertionError: allocating min = 592 allowed = 616 -- list  size 20

It was hard enough writing 2023, but JDK 21?

SethTisue commented 1 year ago

closing as "not planned", since small-seq-apply.scala succeeds on the latest JDK 20 prerelease, and the final release of JDK 20 is expected this month

I'm working on making the test suite pass on JDK 20 at https://github.com/scala/scala/pull/10306 and https://github.com/scala/scala/pull/10335 , and if I hit any allocation failures I'll check Som's notes above