RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.58k stars 248 forks source link

incompatible serialized files between 2.x and 3.x versions (tested while upgrading to java 17) #319

Open istinnstudio opened 2 years ago

istinnstudio commented 2 years ago

I have tried to upgrade fst from version 2.57/java11 to 3.0.3/java17 and see what happens

As far as I can see, in my case, first of all, there are some reflection related error messages like this one: Exception in thread "AWT-EventQueue-0" java.lang.reflect.InaccessibleObjectException: Unable to make private void java.awt.geom.Path2D$Double.writeObject(java.io.ObjectOutputStream) throws java.io.IOException accessible: module java.desktop does not "opens java.awt.geom" to unnamed module @df84c76 .... Exception in thread "AWT-EventQueue-0" java.lang.reflect.InaccessibleObjectException: Unable to make field int java.awt.Color.value accessible: module java.desktop does not "opens java.awt" to unnamed module @594255bc

those issues have been temporarily resolved by adding " --add-opens=java.desktop/java.awt.geom=ALL-UNNAMED" or " --add-opens=java.desktop/java.awt=ALL-UNNAMED" etc. ... for every error case as suggested here: https://github.com/RuedigerMoeller/fast-serialization/issues/312

But it seems that there is some kind of incompatibility between 2.x and 3.x versions. Serialization files are incompatible between those versions and i/o between them fails. Is this normal? Additionally, after some short tests with 2.57/java17 (after resolving all those reflect.InaccessibleObjectException errors), everything seems to work ok! with all my 2.x serialized files, without any i/o issues so far... so I guess it is ok to still use 2.x version and move to 3.x only when there is a serious reason to do so. What do you think?

istinnstudio commented 2 years ago

https://github.com/RuedigerMoeller/fast-serialization/issues/306#issuecomment-719535746

.. a way to develop a converter between different versions, reposting the link.

winrid commented 2 years ago

Also running into this. It seems like we can't use Java 17 on our backend and 1.8 on Android because we need 3.x to use Java 17?

fyi @RuedigerMoeller

winrid commented 2 years ago

I see, it appears that maybe 2.57 will work fine with Java 17.

RuedigerMoeller commented 2 years ago

there is a branch targeting java 17. It also adapts the offheap code to foreign memory incubator api. On maven there is 3.0.3-jdk17 . In this branch there is also a list of add-opens parameters (readme) so you can run it with jdk 17

Am So., 8. Mai 2022 um 22:29 Uhr schrieb Devon @.***>:

Also running into this. It seems like we can't use Java 17 on our backend and 1.8 on Android because we need 3.x to use Java 17?

fyi @RuedigerMoeller https://github.com/RuedigerMoeller

— Reply to this email directly, view it on GitHub https://github.com/RuedigerMoeller/fast-serialization/issues/319#issuecomment-1120482405, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOQYDGG6S7RHKSCDWJFZZTVJAPZJANCNFSM5KTEY7MQ . You are receiving this because you were mentioned.Message ID: @.***>

Tiller commented 2 years ago

In this branch there is also a list of add-opens parameters (readme) so you can run it with jdk 17

@RuedigerMoeller is there?

winrid commented 2 years ago

Yeah but Android only supports 1.8 so it's not v3 compatible right?

istinnstudio commented 2 years ago

"there is a branch targeting java 17". I am not sure if this is something really worth to do, but (I think) I have easily managed to back-port the "memory api of java 17" from jdk-17 branch https://github.com/RuedigerMoeller/fast-serialization/tree/jdk17/src/main/java/org/nustaq/offheap to 2.57 (sources from maven not git) just for fun to see if possible. It seems to work ok with my i/o serialization in place replacement of native. I could post a link of a project that compiles ok with edited maven. It still needs " -add-opens ...", and does not break previously created serialization. I do not know if there is any valuable benefit from this, and maybe buggy. I am not familiar with the internals of fast-serialization. So there might be a chance that new code could live ok in the latest 2.x version. More experienced users could evaluate this.

edit: https://github.com/istinnstudio/fast-serialization-2.57-java17

thalesvalias commented 1 year ago

@RuedigerMoeller hey, sorry, I know this is a bit old, but in your previous comment you mentioned a list of add-opens parameters on readme in the jdk17 branch, however, I couldn't find it anywhere. Actually, that readme is not updated taking into account java 17. Maybe I'm missing something. Anyway, thanks