Data saved but no saga saved


We’re using NServiceBus 4.6.5, with Oracle database, and for a specific request, intermittently the data is saved into our database, but the corresponding sagaData is not saved to the database.

I looked at the logs and can’t find an explanation.

If you need me to post here more information just let me know, as I have no idea where to start.



It would be useful to see how you configure the Bus and how the handler manages the transactions and/or connections to the database.


This question is a double post of this one on StackOverflow.

I added the code into this Stack Overflow Question: NServiceBus Data saved but no saga saved - Stack Overflow

We have a Master and 2 Worker Servers. Might it be the case that the SagaData in 1 server is out of sync with the SagaData in another server? We persist the SagaData to Oracle.

How does NServiceBus guarantee that the SagaData in our situation is in sync in the 3 servers (Master and Workers)?

Edit: I added another Stack Overflow Question: synchronization - NServiceBus - How to make sure SagaData is in sync between the Worker Servers? - Stack Overflow


The links you pasted point to the same question. Was that intentional?

Regarding the missing changes in the saga data. Do you know if the changes are missing permanently or they are not visible just yet when the second message arrives? i.e. the second message gets processed concurrently with the first message.

The saga data objects are not stored in memory. The changes are synced back to the database before committing the message receive transaction. NHibernate persistence by default uses optimistic concurrency approach by appending a WHERE clause to each UPDATE using values known at the time of loading the saga. This prevents two messages from updating the saga information concurrently without knowing about each other thus overwriting each other’s data.