pekko icon indicating copy to clipboard operation
pekko copied to clipboard

[EXPERIMENT] test with java 24

Open pjfanning opened this issue 1 year ago • 15 comments

temporary test run but may be refactored later to run nightly

pjfanning avatar Oct 15 '24 19:10 pjfanning

running into Java deprecations for methods on 'Unsafe' class

[info] compiling 208 Scala sources and 28 Java sources to /home/runner/work/pekko/pekko/actor/target/scala-2.13/classes ...
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala:373:63: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]         case x                                  => if (unsafe.compareAndSwapObject(this, taskOffset, x, replaceWith)) x else extractTask(replaceWith)
[error]                                                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:69:42: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   def underlying: Cell = Unsafe.instance.getObjectVolatile(this, cellOffset).asInstanceOf[Cell]
[error]                                          ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:70:32: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   def lookup = Unsafe.instance.getObjectVolatile(this, lookupOffset).asInstanceOf[Cell]
[error]                                ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:74:25: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (Unsafe.instance.compareAndSwapObject(this, cellOffset, old, next)) old else swapCell(next)
[error]                         ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:79:25: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (Unsafe.instance.compareAndSwapObject(this, lookupOffset, old, next)) old else swapLookup(next)
[error]                         ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:41:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.childrenOffset).asInstanceOf[ChildrenContainer]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:68:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.functionRefsOffset).asInstanceOf[Map[String, FunctionRef]]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:87:28: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]       if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.functionRefsOffset, old, added)) rec()
[error]                            ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:102:30: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]         if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.functionRefsOffset, old, removed)) rec()
[error]                              ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:114:8: method getAndSetObject in class Unsafe is deprecated (since 23)
[error]       .getAndSetObject(this, AbstractActorCell.functionRefsOffset, Map.empty)
[error]        ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:121:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val num = Unsafe.instance.getAndAddLong(this, AbstractActorCell.nextNameOffset, 1)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:125:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val num = Unsafe.instance.getAndAddLong(this, AbstractActorCell.nextNameOffset, 1)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:154:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.childrenOffset, oldChildren, newChildren)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:187:21: method putObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.putObjectVolatile(this, AbstractActorCell.childrenOffset, TerminatedChildrenContainer)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:56:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.mailboxOffset).asInstanceOf[Mailbox]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:60:26: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.mailboxOffset, oldMailbox, newMailbox))
[error]                          ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:127:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val old = Unsafe.instance.getAndAddLong(this, inhabitantsOffset, add)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:139:49: method getLongVolatile in class Unsafe is deprecated (since 23)
[error]   final def inhabitants: Long = Unsafe.instance.getLongVolatile(this, inhabitantsOffset)
[error]                                                 ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:141:61: method getIntVolatile in class Unsafe is deprecated (since 23)
[error]   private final def shutdownSchedule: Int = Unsafe.instance.getIntVolatile(this, shutdownScheduleOffset)
[error]                                                             ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:143:21: method compareAndSwapInt in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapInt(this, shutdownScheduleOffset, expect, update)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:124:61: method getIntVolatile in class Unsafe is deprecated (since 23)
[error]   final def currentStatus: Mailbox.Status = Unsafe.instance.getIntVolatile(this, AbstractMailbox.mailboxStatusOffset)
[error]                                                             ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:137:21: method compareAndSwapInt in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapInt(this, AbstractMailbox.mailboxStatusOffset, oldStatus, newStatus)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:140:21: method putIntVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.putIntVolatile(this, AbstractMailbox.mailboxStatusOffset, newStatus)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:213:23: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]       Unsafe.instance.getObjectVolatile(this, AbstractMailbox.systemMessageOffset).asInstanceOf[SystemMessage])
[error]                       ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:220:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractMailbox.systemMessageOffset, _old.head, _new.head)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:[553](https://github.com/apache/pekko/actions/runs/11352818502/job/31576426284#step:6:554):21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, watchedByOffset).asInstanceOf[Set[ActorRef]]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:[556](https://github.com/apache/pekko/actions/runs/11352818502/job/31576426284#step:6:557):21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, watchedByOffset, oldWatchedBy, newWatchedBy)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:576:53: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   private[this] def state: AnyRef = Unsafe.instance.getObjectVolatile(this, stateOffset)
[error]                                                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:579:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, stateOffset, oldState, newState)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:581:72: method putObjectVolatile in class Unsafe is deprecated (since 23)
[error]   private[this] def setState(newState: AnyRef): Unit = Unsafe.instance.putObjectVolatile(this, stateOffset, newState)
[error]                                                                        ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:321:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractCircuitBreaker.stateOffset, oldState, newState)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:329:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractCircuitBreaker.stateOffset).asInstanceOf[State]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:335:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:345:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractCircuitBreaker.resetTimeoutOffset).asInstanceOf[FiniteDuration]
[error]                     ^
[error] 34 errors found

pjfanning avatar Oct 15 '24 19:10 pjfanning

We need later move to Java 11 and migrate some code to VarHandle I think, as Java 25 is coming next year, which is a LTS version.

He-Pin avatar Nov 29 '24 06:11 He-Pin

The biggest issue is having our builds fail if we use any deprecated code. Scala 2.13.15 upgrade is blocked for similar reasons.

pjfanning avatar Nov 29 '24 07:11 pjfanning

How about add @nowarn("msg=deprecated") on these classes? @pjfanning , I have not setup my new mac, will try when back home.

He-Pin avatar Nov 29 '24 08:11 He-Pin

We have to support 3 Scala versions and the deprecation warnings are different on them. Add extra nowarn annotations and they can fix one build but break another.

pjfanning avatar Nov 29 '24 08:11 pjfanning

I'm working on this, I think we should test the latest JDK too.

He-Pin avatar Jan 17 '25 19:01 He-Pin

https://github.com/scala/scala3/actions/runs/12867480602

He-Pin avatar Jan 20 '25 12:01 He-Pin

@pjfanning 3.3.5-RC3 is released.

He-Pin avatar Jan 21 '25 05:01 He-Pin

@pjfanning how about update this pr to make it test JDK23, it should be ok now.

He-Pin avatar Feb 15 '25 07:02 He-Pin

We can now test with JDK 24. refs: https://github.com/netty/netty/pull/14943 FYI

He-Pin avatar Mar 20 '25 02:03 He-Pin

Scala 2.12.20 does not properly support Java 24

[03-20 21:46:14.741] [error] Error while emitting Future.scala
[03-20 21:46:14.741] [error] Unsupported class file major version 68
[03-20 21:46:14.941] [error] Error while reading InlineInfoAttribute from scala.Function1

pjfanning avatar Mar 20 '25 21:03 pjfanning

@SethTisue Is there any update for next 2.12.x for JDK 24?

He-Pin avatar Mar 21 '25 04:03 He-Pin

@SethTisue If you cut a new Scala 2.12.x release, it would be great if that would also already unlock Java 25 by upgrading asm (I hope they cut a new release soon) - so we can test early with latest ea builds already (since it's the next LTS) :

  • https://gitlab.ow2.org/asm/asm/-/merge_requests/420
  • https://gitlab.ow2.org/asm/asm/-/issues/318029

mkurz avatar Mar 21 '25 11:03 mkurz

Scala 2.13.16 run went ok - some test failures due to TLS changes in Java 24. Some TLS protocols or cipher suites have been removed.

Scala 3.3.5 run failed with:

[03-20 21:46:39.386] [info] compiling 1 Scala source to /home/runner/work/pekko/pekko/actor/target/scala-3.3.5/CompileJdk9-classes ...
[03-20 21:46:39.395] [error] 24 is not a valid choice for -java-output-version
[03-20 21:46:39.396] [info]   scalac -help  gives more information
[03-20 21:46:39.397] [error] one error found

pjfanning avatar Mar 21 '25 11:03 pjfanning

@mkurz @He-Pin you can state your case over at https://contributors.scala-lang.org/t/scala-2-12-21-release-planning/6753

SethTisue avatar Mar 21 '25 14:03 SethTisue

@pjfanning @raboof Wdyt about it, should we run a nightly test with JDK24?

He-Pin avatar May 09 '25 12:05 He-Pin

Wdyt about it, should we run a nightly test with JDK24?

Are the failures in this branch now resolved? If so might be nice (though perhaps we should move some of those to weekly rather than nightly?)

raboof avatar May 09 '25 13:05 raboof

we also hit issues with TLS ciphers that are no longer supported

[05-09 14:43:22.654] [info]     javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:162)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:245)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:104)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.setNewSessionParameters(TLSActor.scala:185)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor$ChoppingBlock.chopInto(TLSActor.scala:115)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.doOutbound(TLSActor.scala:335)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.$anonfun$bidirectional$1(TLSActor.scala:247)

pjfanning avatar Jun 07 '25 10:06 pjfanning