Sagas responding to events after lifecycle ended

Hello,

I’m having an issue where a saga which sometimes continues to have event handlers respond to events after its lifecycle is ended. JdbcSagaStore is frequently logging the warning “Expected to be able to update a Saga instance, but no rows were found. Inserting instead” immediately after the event ends. There doesn’t seem to be consistent series of events that causes it, but usually it’s something like:

saga starts
some events are successfully processed
the saga ends
(something on the order of ~200ms passes)

Another event comes in (and is handled by the saga) and right after that handler finishes, JdbcSagaStore logs the warning.

There are several places that the lifecycle can end in this saga, and it doesn’t matter which code path lead to SagaLifecycle.end() being called.

I’m running Axon 3.4.3, Java 8, jdbc .

Best,
Skyler Arnold

Hi Skyler,

for some reason, the choice was made in the JDBC Saga Store to insert Saga instances when an update impacted 0 instances. The JPA implementation makes the assumption that the entry was removed, and shouldn’t be updated at all. The latter seems correct at first glance, to me.

Did you configure any Caches for your Sagas? I’m wondering how it could find a Saga instance if it has been removed from the database.

Cheers,

twitter-icon_128x128.png

Hi Allard,

Nope, there’s no caching implemented.

Best,
Skyler Arnold