Add missing @serialversionuid on collections#9166
Conversation
df77e8e to
b484717
Compare
|
Hi @SethTisue and @lrytz not sure who to ping. Any thoughts? Thanks! |
NthPortal
left a comment
There was a problem hiding this comment.
I believe the UIDs should be 3L not 2L, as collections are not compatible across Scala versions.
Other than that, LGTM!
Note that this PR targets 2.12.x I think we remain serialization compatible between minor releases, the test t8549.scala (SerializationStabilityTest.scala in 2.13.x) checks that (at least to some degree). Java's default serialization always includes the serial version UID. If not specified explicitly (using an annotation in Scala, a field in Java), the value is calculated based on the class structure. When the UID doesn't match on deserialization, an Therefore I don't think we can just set the serial version UID to 2 (or 3) for classes that currently don't have an annotation, as it will break serialization compatibility. What we can do however is make the calculated UID explicit and put it into an annotation. The |
|
Let me add that adding an explicit See scala/scala-dev#237. |
gah, I always miss that. sorry! |
|
@regadas interested in continuing with this? |
|
Hi @SethTisue yeah sorry for the delay! I was on vacation recently and I was still catching up! I'll have a look at the comments! Thx for the poke! |
|
@regadas closing for inactivity, but we can reopen anytime |
|
I'm confused. Is this going to be fixed in 2.12? I'm running into this problem with Spark 3.0.1 on Scala 2.12. Spark 3.0.1 seems to bundle 2.12.10, which is not compatible with 2.12.12 due to this issue. I believe the incompatibility was introduced by b8226e1. |
|
I don't know how to fix this. Revert the commit? |
see @lrytz's #9166 (comment) — followup questions welcome |
|
Let's make sure we're on the same page. Is this serialization issue a bug? |
|
yes, it is scala/bug#5046, which was fixed for 2.13 but not for 2.12 |
|
Hi @SethTisue Sorry for this, tbh i completely forgot to follow up on this! Let me revive this this week as I have some time now /cc @mallman |
|
I'm going to stick with 2.12.10 for now. I don't have the time to work on a PR for this. |
Thank you @regadas. |
8191a64 to
9d1b083
Compare
Sorry, maybe I misunderstand. To be clear, will 2.12.14 be fully serialization-compatible with 2.12.10? |
I don't think so, there are classes without The best we can do is to add |
|
An example of how to get the SerialVersionUID: #8778 (comment). |
Let me give some more background around my query. Spark 3.0.1 ships with Scala 2.12.10. When I try to run a Spark job with Scala 2.12.12 I encounter a serialization failure: From a practical perspective, I'm hoping to see Spark 3.0.1 (+) become compatible with maintenance releases of Scala 2.12 moving forward, so we are not stuck with Scala 2.12.10. I know that the OP referenced Flink compatibility issues as well. Is that a shared goal here, and is it achievable? |
|
(MiMa part needs rebase because of #9436) |
|
@mallman sorry for my late reply! We probably could set the explicit Does that sound OK? @regadas do you have time to rebase this to fix the merge conflicts, and to update the annotations to the 2.12.13 values? |
Hi @lrytz. Your perspective makes sense—let's not break things that were built against 2.12.12 or 2.12.13. I'm not sure if the Spark team is aware of this issue. I didn't find anything from performing a cursory search of their issue tracker. Their current master pom.xml still lists Scala 2.12.10, and Spark 3.1.1 is at rc2 at this point. I will try to raise an issue and submit a PR to upgrade to Spark to Scala 2.12.13, but I think it's unlikely it will be merged in time for Spark 3.1.1. Thank you. |
That upgrade was previously tried and reverted due to a bug: apache/spark#31223 (comment) (the fix for that bug will be in 2.12.14). |
Thank you for pointing that out. |
|
@lrytz I'll spend some time on this today. |
6e709bc to
0dc579e
Compare
|
@lrytz I think I addressed everything let me know If I missed smth. |
0dc579e to
a5c4802
Compare
Add missing @serialversionuid on collections
Add missing @serialversionuid on collections
Java serialization issue fixed in scala 2.12.14: scala/scala#9166 Remove `reporter.printSummary` after the scala file compilation, because this api has been removed in scala 2.12.13
Java serialization issue fixed in scala 2.12.14: scala/scala#9166 Remove `reporter.printSummary` after the scala file compilation, because this api has been removed in scala 2.12.13
Hi 👋
I recently stumbled upon scala/bug#5046 while trying to run some scala jobs on Flink. I see that this made it to 2.13 but Flink still runs 2.11/2.12 and per @SethTisue comment I backported some of the changes.
Also, per @lrytz scala/collection-strawman#418 i thought I could set the new
@SerialVersionUIDto2Land keep the already set ones as is.Let me know what you think! Thanks!