Skip to content

Conversation

@JoshRosen
Copy link
Contributor

@JoshRosen JoshRosen commented Apr 8, 2016

This patch allows several of the chill modules to be built for Scala 2.12.0.

Several subprojects, such as chill-akka and chill-bijection, cannot currently be published for 2.12 because their dependencies have not been published yet. To work around this, I used the sbt-doge plugin, which overrides ++ and + to respect subprojects' crossScalaVersions settings, allowing you to run

> ; + clean; + test; + publishLocal

to test and publish for all Scala versions.

Refs #252.

@JoshRosen
Copy link
Contributor Author

java.lang.NoClassDefFoundError: java/lang/invoke/SerializedLambda
    at com.esotericsoftware.kryo.serializers.ClosureSerializer.<clinit>(ClosureSerializer.java:42)
    at com.twitter.chill.AllScalaRegistrar.apply(ScalaKryoInstantiator.scala:207)
    at com.twitter.chill.ScalaKryoInstantiator.newKryo(ScalaKryoInstantiator.scala:97)
    at com.twitter.chill.avro.AvroSerializerSpec$$anonfun$5.apply(AvroSerializerSpec.scala:34)
    at com.twitter.chill.avro.AvroSerializerSpec$$anonfun$5.apply(AvroSerializerSpec.scala:34)
    at com.twitter.chill.package$$anon$1.newKryo(package.scala:30)
    at com.twitter.chill.KryoPool$2.newInstance(KryoPool.java:59)
    at com.twitter.chill.KryoPool$2.newInstance(KryoPool.java:57)
    at com.twitter.chill.ResourcePool.borrow(ResourcePool.java:37)

It looks like I need to add logic to not register ClosureSerializer unless we're running on a Java 8 JRE.

k.register(boxedUnit.getClass, new SingletonSerializer(boxedUnit))
PackageRegistrar.all()(k)

// Enable Java 8 lambda serialization only if we are running on a Java 8 JRE:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question: what's the best place to register this? And what happens if it already happens to have been registered by some other means?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make a Java8ClosureRegistrar that is an IKryoRegistrar: https://github.com/twitter/chill/blob/develop/chill-java/src/main/java/com/twitter/chill/IKryoRegistrar.java and it should be a no-op when we are not on java8 (as you have below).

See for instance the PackageRegistrar.all() above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea; will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, forgot about this comment until now. I've created a Java8ClosureRegistrar to abstract away this code.

@johnynek
Copy link
Collaborator

looks great. I don't want to merge pointing to a SNAPSHOT so whenever we can fix that, we should merge.


// use the singleton serializer for boxed Unit
val boxedUnit = scala.Unit.box(())
val boxedUnit = scala.runtime.BoxedUnit.UNIT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't be necessary in M5, fixed in scala/scala#5100

@jodersky jodersky mentioned this pull request Sep 9, 2016
@johnynek
Copy link
Collaborator

do you have any interest in this still?

The PR was red, and I didn't look into it much till now. It looks like it may have been a transient error with Travis. I restarted it.

@johnynek
Copy link
Collaborator

if you can merge with develop and bump to a non-snapshot version of kryo 3.x.y I'll merge this.

@jodersky
Copy link

jodersky commented Nov 3, 2016

I think kryo 3.1 is required as it solves an issue with registering closure serializers (EsotericSoftware/kryo#299). Unfortunately 3.1 was never released, and the project went straight ahead to 4.0.0.
#258 would fix the issue and unblock this PR

@magro
Copy link

magro commented Nov 3, 2016

@johnynek Out of interest, is there anything holding you back to switch to kryo 4.0.0?

@johnynek
Copy link
Collaborator

johnynek commented Nov 4, 2016

So, sadly, many people against our recommendation have used kryo
serialization for long term storage. This creates a large anxiety for such
users to upgrade versions due to fear they are going to subtly break their
data pipelines.

I'm happy to help merge and release chill for later Kryos (basically we
increment a version each time we do that). It's a pain to have several
concurrent versions running though.

So, I'm happy to make a new version of chill with the latest kryo.
On Wed, Nov 2, 2016 at 23:52 Martin Grotzke [email protected]
wrote:

@johnynek https://github.com/johnynek Out of interest, is there
anything holding you back to switch to kryo 4.0.0?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#253 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEJdv3ZM6qNb3ATa_PKeSskW0sFgUXEks5q6a74gaJpZM4IDcTm
.

@johnynek
Copy link
Collaborator

johnynek commented Nov 4, 2016

Do you want to bump this up to 2.12.0?

@magro
Copy link

magro commented Nov 4, 2016

@johnynek Ok, I fully understand this. Thanks for taking the route to kryo 4!

@jodersky jodersky mentioned this pull request Nov 4, 2016
@JoshRosen JoshRosen changed the title [WIP] Cross-build (most projects) for Scala 2.12.0-M4 [WIP] Cross-build (most projects) for Scala 2.12.0 Nov 4, 2016
@JoshRosen
Copy link
Contributor Author

I just updated this to build against 2.12.0 final. Once #258 is merged I can update this to use Kryo 4. @johnynek, I'm going to click the "Allow edits from maintainers" button in case you want to update and merge this after #258 goes in. Otherwise, I can do it myself.

@johnynek
Copy link
Collaborator

johnynek commented Nov 6, 2016

okay, merged #258. if you merge develop, I'll merge this.

@JoshRosen JoshRosen changed the title [WIP] Cross-build (most projects) for Scala 2.12.0 Cross-build (most projects) for Scala 2.12.0 Nov 7, 2016
@JoshRosen
Copy link
Contributor Author

This is now passing tests and I think should be ready for a final review. Let me know if you'd like me to make any changes.

@sritchie-stripe
Copy link

LGTM, but let's wait on @johnynek for the final shipit.

Once scala 2.12 ships do we have any plans to remove support for 2.10, or are we committed to three minor versions?

@johnynek
Copy link
Collaborator

Okay. This looks good. Let's merge this and this can be the 0.9.x branch for Kryo 4.x

@johnynek johnynek merged commit da51348 into twitter:develop Nov 10, 2016
@JoshRosen JoshRosen deleted the scala-2.12 branch November 10, 2016 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants