After some refactoring we suddenly see this happening at runtime:
java.lang.StackOverflowError: null
at scala.collection.MapLike$MappedValues.get(MapLike.scala:249)
at scala.collection.MapLike$MappedValues.get(MapLike.scala:249)
at scala.collection.MapLike$MappedValues.get(MapLike.scala:249)
at scala.collection.MapLike$MappedValues.get(MapLike.scala:249)
at scala.collection.MapLike$MappedValues.get(MapLike.scala:249)
We found similar issues but none of them had exactly this trace:
The mentioned issues point to the lazyness of
MapLike.mapValues
and after some further research we found the cause.We have some cleanup code that is periodically called and does something like this:
the solution was to switch to
Map.transform
or to force the view as explained here