Skip to content

fix(deps): pin kryo to 4.0.2 to restore IdentityObjectIntMap.clear fix (kryo #558/#549) - #2310

Merged
amolnayak311 merged 1 commit into
filodb:developfrom
amolnayak311:fix/pin-kryo-4.0.2
Jul 15, 2026
Merged

amolnayak311 merged 1 commit into
filodb:developfrom
amolnayak311:fix/pin-kryo-4.0.2

Conversation

@amolnayak311

Copy link
Copy Markdown
Contributor

The Scala 2.13 upgrade left kryo resolving to 4.0.0 in the assembly. Two differently-named kryo artifacts coexist on the classpath — plain com.esotericsoftware:kryo (from de.javakaffee:kryo-serializers + the direct pin) and com.esotericsoftware:kryo-shaded:4.0.2 (via chill). sbt does not evict across different artifact names, and sbt-assembly's MergeStrategy.first for com.esotericsoftware.** arbitrarily selected the plain kryo:4.0.0 classes in the newer build.

kryo 4.0.0 predates fix #558/#549 ("IdentityObjectIntMap.clear taking more time — Realloc instead of clearing large maps"): MapReferenceResolver.reset()/DefaultClassResolver.reset() call clear() (walks the entire retained backing array) instead of clear(2048) (realloc/shrink). On query fan-in (aggregator) nodes the pooled Kryo reference map never shrinks after a large result, so every subsequent reset() is O(peak-capacity) — observed as a hot IdentityObjectIntMap.clear() in JFR profiles plus retained-map GC pressure.

Pinning kryo to 4.0.2 evicts the 4.0.0 copy so both kryo and kryo-shaded resolve to 4.0.2; verified the built assembly's MapReferenceResolver.reset() now uses clear(2048).

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

Current behavior :

No change in behavior expected

New behavior :

No change in behavior expected

…x (kryo filodb#558/filodb#549)

The Scala 2.13 upgrade left kryo resolving to 4.0.0 in the assembly. Two
differently-named kryo artifacts coexist on the classpath — plain
`com.esotericsoftware:kryo` (from de.javakaffee:kryo-serializers + the
direct pin) and `com.esotericsoftware:kryo-shaded:4.0.2` (via chill).
sbt does not evict across different artifact names, and sbt-assembly's
`MergeStrategy.first` for `com.esotericsoftware.**` arbitrarily selected
the plain `kryo:4.0.0` classes in the newer build.

kryo 4.0.0 predates fix filodb#558/filodb#549 ("IdentityObjectIntMap.clear taking
more time — Realloc instead of clearing large maps"):
MapReferenceResolver.reset()/DefaultClassResolver.reset() call `clear()`
(walks the entire retained backing array) instead of `clear(2048)`
(realloc/shrink). On query fan-in (aggregator) nodes the pooled Kryo
reference map never shrinks after a large result, so every subsequent
reset() is O(peak-capacity) — observed as a hot IdentityObjectIntMap.clear()
in JFR profiles plus retained-map GC pressure.

Pinning `kryo` to 4.0.2 evicts the 4.0.0 copy so both `kryo` and
`kryo-shaded` resolve to 4.0.2; verified the built assembly's
MapReferenceResolver.reset() now uses clear(2048).
@amolnayak311
amolnayak311 merged commit 1f97253 into filodb:develop Jul 15, 2026
1 check passed
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.

3 participants