Skip to content

Releases

kryo-5.7.1

Choose a tag to compare

@theigl theigl released this 07 Oct 08:57

This is a maintenance release that fixes the serializers for unmodifiable and synchronized collections introduced in 5.7.0.

Highlights

Registration in a fixed order (#1351)

registerSerializers registered the wrapper classes in HashMap order, so their registration IDs depended on the JVM: eg the unmodifiable list had ID 11 on JDK 17 and 13 on JDK 21. Data written on one JVM could be read as a different wrapper type on another. The new register(Kryo) registers the classes, including the navigable wrappers, in a fixed order:

UnmodifiableCollectionSerializers.register(kryo);
SynchronizedCollectionSerializers.register(kryo);

registerSerializers is deprecated and keeps its IDs, so existing data stays readable. See the upgrade notes below before switching.

Navigable and sequenced wrappers (#1351)

addDefaultSerializers of UnmodifiableCollectionSerializers and SynchronizedCollectionSerializers didn't cover the navigable wrappers (eg Collections.unmodifiableNavigableSet) and the Java 21+ unmodifiable sequenced wrappers (eg Collections.unmodifiableSequencedCollection). These were silently read back as a different wrapper type, eg an UnmodifiableNavigableSet as an UnmodifiableSortedSet. They are now serialized correctly. The serialized bytes are unchanged, so 5.7.0 and 5.7.1 can read each other's data.

All changes

  • #1351 Add serializers for navigable and sequenced wrapper collections and register them in a fixed order

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Behavioral changes

  • If you use registerSerializers, switch to register(Kryo). It registers the 9 wrapper classes of each type in a different order, so their registration IDs change once: data written with registerSerializers can't be read after switching to register. Switch when you don't need to read previously written data that contains these wrappers, or keep registerSerializers until then.
  • register(Kryo) throws an exception if the JDK internals can't be accessed, while the deprecated registerSerializers logged a warning and skipped the registration. addDefaultSerializers still logs a warning.
  • register(Kryo) doesn't register the Java 21+ sequenced wrappers, so that the same classes are registered on all Java versions. After addDefaultSerializers, they can be registered with kryo.register(Class).

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.7.0

Choose a tag to compare

@theigl theigl released this 01 Oct 14:05

This is a feature release that hardens deserialization against corrupt or malicious input, adds long-requested serializers for unmodifiable and synchronized JDK collections, and fixes several bugs. It also improves compatibility with recent JDKs up to Java 26.

Highlights

Safer deserialization of untrusted or corrupt data (#1284)

Before this release, a tiny corrupt payload that declared a huge array, string, collection or map size could make Kryo allocate gigabytes of memory and fail with an OutOfMemoryError. Kryo now checks declared sizes against the bytes left in the buffer before it allocates anything, and rejects impossible array and string sizes with a KryoException. Collection and map capacities are capped at the bytes remaining. When reading from an InputStream, where the total size isn't known in advance, you can cap declared sizes with the new Input.setMaxArraySize(int):

input.setMaxArraySize(1024 * 1024); // reject any declared array/string/collection/map size above 1M elements

Serializers for unmodifiable and synchronized collections (#1154)

Kryo now includes serializers for the JDK's Collections.unmodifiable* and Collections.synchronized* wrappers. This has been one of the most requested features. Because they read private JDK fields through sun.misc.Unsafe, they are not registered by default and must be enabled explicitly:

UnmodifiableCollectionSerializers.addDefaultSerializers(kryo);
SynchronizedCollectionSerializers.addDefaultSerializers(kryo);
// or, when registration is required:
UnmodifiableCollectionSerializers.registerSerializers(kryo);
SynchronizedCollectionSerializers.registerSerializers(kryo);

See the README for details.

All changes

  • #1154 Add serializers for unmodifiable and synchronized collections
  • #1179 Add better feedback when using abstract classes in serialization (thanks @pvlov)
  • #1183 Add ConcurrentHashMap.KeySetView serializer (thanks @bergander)
  • #1253 Make @Optional annotation repeatable (thanks @www84)
  • #1271 Use constants for array base offsets instead of Unsafe.arrayBaseOffset to avoid warnings on JDK 25+
  • #1283 Fix generics stack leak that poisoned reused Kryo instances (thanks @Icesource)
  • #1284 Guard deserialization against unbounded allocation from declared sizes (thanks @joszamama)
  • #1300 Cache the Java serializer lookup per type in ExternalizableSerializer (thanks @vpaturet)
  • #1309 Preserve circular references in externalizable objects (thanks @Ishubhammohole)
  • Revert wrapping of OutOfMemoryError in KryoException in FieldSerializer (#829)
  • Log a warning when @BindCollection or @BindMap sets a serializer without the element, key, or value class, and improve the error when a serializer factory in @Bind, @BindCollection, or @BindMap needs the missing class
  • Fix the error message for duplicate tags in TaggedFieldSerializer, which could throw an IndexOutOfBoundsException instead
  • Upgrade Objenesis from 3.4 to 3.6

Other Tasks:

  • Test CI build against Java 23, 24, 25 and 26
  • Switch release publishing to the Central Portal (#1188)
  • Ensure main sources are always compiled for Java 8, regardless of the JDK used for the build
  • Fix nondeterministic tests (#1219, #1220, #1227) (thanks @yonghanlin, @annhchen89)
  • Documentation updates (#1245) (thanks @fzhyzamt)
  • Upgrade Maven plugins and test dependencies

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Behavioral changes

  • Malformed input that declares array or string sizes larger than the remaining data now fails fast with a KryoException instead of trying to allocate memory. Collection and map capacities are capped instead (#1284).
  • FieldSerializer no longer wraps OutOfMemoryError in a KryoException. Errors are now passed through unchanged.
  • Kryo.reset() now also clears the generics stacks, so an exception during (de)serialization no longer leaves pooled or thread-local Kryo instances in a broken state (#1283).

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.6.2

Choose a tag to compare

@theigl theigl released this 10 Oct 09:42

This is a maintenance release that recompiles 5.6.1 to restore compatibility with Java 8.

#1134 Recompile to ensure Java 8 support

Other Tasks:

  • Ensure release build can only happen with JDK 11

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.6.1

Choose a tag to compare

@theigl theigl released this 07 Oct 09:38

DO NOT USE THIS VERSION

This version was accidentally targeted to Java 17. Use 5.6.2+ instead.


This is a maintenance release fixing wrong coordinates for the versioned artifact.

#1045 Re-add groupId to versioned POM

Other Tasks:

  • Fix deployment of snapshot builds
  • Upgrade Maven plugin dependencies

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.6.0

Choose a tag to compare

@theigl theigl released this 08 Jan 14:48

This is a maintenance release coming with bug fixes and performance improvements.

#968 Avoid creating GenericsHierarchy when generics optimization is disabled
#1014 BigDecimal serializer memory and throughput optimizations (thanks @gdela)
#1018 Avoid allocation in BigDecimal serializer with new methods for bytes in Input/Output (thanks @gdela)

Other Tasks:

  • Streamline Maven project structure and add Dependabot (#957)
  • Test CI build against Java 21 (#1017)
  • Upgrade Maven plugin dependencies

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-4.0.3

Choose a tag to compare

@theigl theigl released this 19 May 09:39

This is a maintenance release coming with bug fixes and performance improvements for chunked encoding.

Improved filling InputChunked buffer (#651)
Support skipping input chunks after a buffer underflow (#850)
Avoid flush repeatedly when has finished flushing (#978)

The full list of changes can be found here.

Many thanks to all contributors!

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.5.0

Choose a tag to compare

@theigl theigl released this 20 Apr 13:31

This is a maintenance release coming with bug fixes and performance improvements.

#944 Avoid slow Class.forName when serializing lambdas
#946 Make the ImmutableCollections serializers public and final
#948 Ensure that record constructors are always accessible
#951 Fix serialization of Kotlin lambdas
#955 Fix type resolution for generic arrays
#956 Performance improvements for Kryo.isClosure()

Other Tasks:

  • Test CI build against Java 20
  • Support for Kotlin tests
  • Upgrade Maven plugin dependencies

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.4.0

Choose a tag to compare

@theigl theigl released this 30 Dec 10:53

This is a maintenance release coming with bug fixes and performance improvements.

The most notable change is performance improvements for record serialization (#927) by caching access to components, getters and constructors. The new implementation is roughly 20x faster.

Several PRs improve Kryo's compatibility with JDK 17+ (#930, #932, #933).

#923 Add helper method to register serializers for java.util.ImmutableCollections (#933)
#885 Delay access to constructor and methods for DirectBuffers until first use (#932)
#885 Add additional safe serializers for commonly used JDK classes (#930)
#884 Cache components, getters and constructors in RecordSerializer (#927)
#922 Fall back to default class resolution if class cannot be loaded with provided class loader (#926)
#920 Align ByteBufferOutput.writeAscii with implementation in Output (#921)
#889 Serializer for java.sql.Timestamp which preserves nanoseconds (#890)
#884 Fix eclipse project setup: Add JUnit 5, ByteBuddy (#887)

Other Tasks:

  • Improve tests for JDK 17 (#886)
  • Upgrade GitHub actions (#925)
  • Upgrade Objenesis to 3.3

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

kryo-5.3.0

Choose a tag to compare

@theigl theigl released this 11 Feb 10:59

This is a maintenance release coming with bug fixes and performance improvements:

#872 Custom exception for buffer over/underflow (#874)
#873 Set record component getter accessible (#875)
#845 Performance improvements for maps (#876)
#845 Use IdentityMap instead of CuckooObjectMap in class resolver (#877)
#882 Catch LinkageError in addition to RTE when accessing fields via ASM (#883)

Other Tasks:

  • Enforce minimum maven version and update plugins and test dependencies

The full list of changes can be found here.

Many thanks to all contributors!

Upgrade Notes

This release brings performance improvements for Kryo's custom map implementations (#876). These improvements allowed us to change the map for resolving registrations in DefaultClassResolver from a CuckooObjectMap to an IdentityMap with 3-5% faster throughput (#877). CuckooObjectMap is now deprecated and will be removed in Kryo 6.

Kryo now throws dedicated exceptions in case of buffer under- or overflows (#872). If you currently parse the error message to check for these conditions, you can catch KryoBufferUnderflowException and KryoBufferOverflowException instead.

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - No (Details)
  • Source compatible - No (Details)

kryo-5.2.1

Choose a tag to compare

@theigl theigl released this 11 Dec 10:48

This is a maintenance release coming with bug fixes and improvements:

#834 Support skipping input chunks after a buffer underflow (#850)
#865 Ensure empty PriorityQueue can be deserialized (#866)
#870 Shade contents of source jar for versioned artifact

Other Tasks:

  • Migrate from Travis CI to GitHub Actions
  • Build and test with JDK 17

The full list of changes can be found here.

Many thanks to all contributors!

For migration from previous major versions please check out the migration guide. We're asking the community to help and contribute this part: please edit the migration wiki page as you encounter any information or issues that might help others.

Compatibility

  • Serialization compatible
    • Standard IO: Yes
    • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)