Skip to content

RememberEntitiesShardStore$UpdateDone is leaking over ExtractorAdapter #3410

Description

@mehmetsalgar

Hi,

I am using

HashCodeNoEnvelopeMessageExtractor

which is only expected my sealed Events and crashes by receiving

RememberEntitiesShardStore$UpdateDone

with Pekko 1.6.0

java.lang.ClassCastException: class org.apache.pekko.cluster.sharding.internal.RememberEntitiesShardStore$UpdateDone cannot be cast to class xxx.TravelSM$TravelSMEvent (org.apache.pekko.cluster.sharding.internal.RememberEntitiesShardStore$UpdateDone and xxx.TravelSM$TravelSMEvent are in unnamed module of loader 'app')
at xxx.TravelSMGuardian$$anon$2.entityId(TravelSMGuardian.scala:364)
at org.apache.pekko.cluster.sharding.typed.internal.ExtractorAdapter.entityId(ClusterShardingImpl.scala:67)
at org.apache.pekko.cluster.sharding.typed.internal.ClusterShardingImpl$$anonfun$1.isDefinedAt(ClusterShardingImpl.scala:177)
at org.apache.pekko.cluster.sharding.Shard$$anonfun$idle$1.applyOrElse(Shard.scala:637)

I think the problem lies in

ExtractorAdapter

override def entityId(message: Any): String = {
message match {
case ShardingEnvelope(entityId, _) => entityId
case ClassicStartEntity(entityId) => entityId
case msg => delegate.entityId(msg.asInstanceOf[E])
}
}

does not forsee that it will receivce events from

RememberEntitiesShardStore

definetely HashCodeNoEnvelopeMessageExtractor does also not.

Is this event leaking to ExtractorAdapter or it is wanted the ExtractorAdapter receive this...

with this configuration

pekko {
....

cluster {
shutdown-after-unsuccessful-join-seed-nodes = 60s
sharding {
remember-entities = on
...
}
....
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions