Distributed Eventbus Event handling exception
ERROR com.hazelcast.client.spi.ClientListenerService - hz.client_0_xyz.event-7 caught an exception while processing task:com.hazelcast.client.spi.impl.listener.ClientListenerServiceImpl$ClientEventProcessor@10b9f532 java.lang.RuntimeException: Internal Error! No session id defined for event bus listener! at com.canoo.dp.impl.server.event.AbstractEventBus.triggerEventHandling(AbstractEventBus.java:150) at com.canoo.dp.impl.server.event.DistributedEventBus$3.onMessage(DistributedEventBus.java:108) at com.hazelcast.client.proxy.ClientTopicProxy$TopicItemHandler.handle(ClientTopicProxy.java:85) at com.hazelcast.client.impl.protocol.codec.TopicAddMessageListenerCodec$AbstractEventHandler.handle(TopicAddMessageListenerCodec.java:126) at com.hazelcast.client.proxy.ClientTopicProxy$TopicItemHandler.handle(ClientTopicProxy.java:70) at com.hazelcast.client.spi.impl.listener.ClientListenerServiceImpl$ClientEventProcessor.run(ClientListenerServiceImpl.java:112) at com.hazelcast.util.executor.StripedExecutor$Worker.process(StripedExecutor.java:187) at com.hazelcast.util.executor.StripedExecutor$Worker.run(StripedExecutor.java:171)
This exception appears in our logs several times in a row.
Do we really have this issue? I have created 2 projects recently using distributed event bus(hazelcast) but never get this exception.
yes. But this is an edge case that can happen based on a missing concurrent lock in our event bus implementation.
This happens if an event is send in the same moment as a session that holds an listener for that event is destroyed. In that case the listener will be removed automatically. removing all listeners for a session and iterating over all listeners for handling an event is not synchronised. Therefore a listener that is removed in the same moment (and therefore do not have a session anymore) can be triggered. This ends in the given exception