-
Notifications
You must be signed in to change notification settings - Fork 75
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
Switch from Java 11 LTS to Java 21 LTS #760
Conversation
accept java 17 source code and produce java 17 bytecode. this will require running on machines with JDK17 installed. use gradle cache functionality built into setup-java Github action.
Seven tests fail, all apparently due to Related
I think we'd have to either write hundreds or thousands of handcrafted serializers, or do some complicated Java configuration to "open" a bunch of packages to Kryo for reflection. I suspect this is going to make migration to Java 17 impractical for the time being. I have seen the broken KryoNetworkSerializerTest pass by adding JVM command line options |
With the tests passing, we now run into problems with shadowJar. The best solution here is probably to simply stop using shadow jars and switch to ZIP distributions containing one jar per dependency. These shadow jars are only used in automated testing, not in our backend and worker instance startup scripts (which now use ZIP distributions). |
shadow jars defy intended Java design and are essentially obsolete instead set up Gradle to run application with the JARs on the classpath will require changing end-to-end/UI testing to use 'gradle runBackend'
6df6e6a
to
00ef573
Compare
Update Github actions versions. Use Java 19. Set max heap to 7G using dedicated parameter. Use UI commit where 'yarn start-backend' performs 'gradle runBackend'.
match dependencies to kryo-tools 1.5 network file version bumped to nv3 update r5 automatic module name eliminate use of Integer constructor in response to deprecation warning
Via a new release of kryo-tools (https://github.com/conveyal/kryo-tools/releases/tag/v1.5.0) this branch is now using the newest Kryo 5.4.0. Recently released at the end of December 2022, this cooperates much better with the Java module system that is now strictly enforced in more recent JVMs. It includes new serializers for internal Java classes so can avoid performing any reflection, so we no longer need any JVM command line switches to open JDK internal modules for reflection. This led me back down the rabbit hole of Java modules - at first the idea of adding our own It seems like there are two differing schools of thought on this - some think that Java modules are now official policy and it's virtuous to push people to adopt them. Others, including some developers of the module system (from whom I picked up on this alternate position) consider the module system something primarily intended for internal JRE usage, to permit making smaller JREs for embedded devices and distributing desktop apps, and for improving security within the JRE itself. This system could have been kept entirely internal to the JRE, indeed some of its developers wanted to, but was made public in case anyone else would get any use out of it, and they say that it's perfectly acceptable if people don't want to use it and just dump all their packages into automatic modules or the unnamed module. So considering that I now have ways to get Kryo, our reflection-based ObjectDiffer, and incubator modules working on Java 19, I think we should continue with the automatic module approach. |
Kryo 5 produces binary output that is incompatible with older versions of Kryo, so the Network version has been bumped to nv3. I added some lines in the Javadoc to track the successive network versions and when they were changed. This PR is pretty much complete. One remaining detail is that it produces only ZIP distributions and not shaded JARs. Not using shaded JARs is a desirable move overall, but requires some changes any place we kick off integration tests to grab the backend JARs via those ZIPs, or via a shallow checkout and a Gradle build without tests. I'll prepare a PR to make those changes before marking this PR ready for review.
|
Next steps after JDK21 release (September 19, 2023):
|
This is now updated to use Java 20, anticipating an R5 release before Java 21 is released and incorporated into our CI/deployment environment. Build is successful / all checks are passing and it's ready for review, but we should probably wait to merge it together with the "regular polling" PR, right before we begin testing, so we can more easily back those changes out in the event of unexpected incompatibilities. |
Align transitive dependency versions. Kryo 5.5 is tested with Java 20. New major version of Guava has security fixes but no breaking changes.
also updated copyright line
Updated to use Java 21 LTS. Corresponding UI changes: https://github.com/conveyal/ui/pull/1941 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran well locally. Tests are passing. Corresponding PRs in cluster and ui are ready. Lets merge 👍
Update
The branch is still called jdk17 for continuity, but the title has been updated to reference the most recent JDK release. Corresponding issue is #852.
Original Description
accept java 17 source code and produce java 17 bytecode.
this will require running on machines with JDK17 installed.
use gradle cache functionality built into setup-java Github action.