Events lost during leader election

Hello, we are having some unknown issues that causes the leader of our three node cluster to freeze for some seconds, triggering a leader election in the two other nodes. Nearly every time this happens, we lose a couple of events when the previous leader starts responding again. It seems like it accepts some events, even though it is not the leader anymore, and tells the client that they were persisted. Shortly afterwards, it realizes this, and goes offline for truncation. Shouldn’t this be impossible by design?

We have had this problem for quite some time, starting with version 5, as discussed in We recently upgraded our clusters to version 21.10.1, but the problem seems to be present still. We have been using both the Akka JVM client, the GRPC Java client, and ESJC, and the problem has occured with all of these.

The logs from all three nodes at the time of the incident can be found below. No events were accepted between 10:27:52 and 10:28:03. The events that are missing were written between 10:28:08.871 and 10:28:09.244. There were also other events written in this timespan that did not get lost. <- NEW LEADER <- OLD LEADER


Hi Anders,

Yes this should be prevented by design.

Were the events lost from the beginning of the streams


No, the events from those streams are still there.

The streams that lost events are not mentioned in the logs. Also, this has been happening with both new streams, and streams that already have events.

Hi Anders,

To our considerable surprise we were able to find a case where the behaviour you described could occur. I’ve filed a ticket for it here

Wow, relieved to hear that! Looking forward to a fix, and hope that it solves the problems we have been seeing. Thanks!