I use Service Broker infrastructure to develop data push approach between multiple servers ( many sources and one destination ). I stick Remus Rusanu recommendations about how reuse or end conversations, for instance this one. I use an user table to store conversation handles and conversation timers to end their.
But sometimes ( not always ) I get errors when ending the conversations:
- This message could not be delivered because the conversation endpoint has already been closed
- The remote conversation endpoint is either in a state where no more messages can be exchanged, or it has been dropped.
Let's take a look two different conversation between the same services. In test purposes conversation timer is 60 seconds.
This is trace for first conversation ( without errors ):
I don't see any problems here.
But this is trace for the second conversation. This conversation has more messages, so the trace is longer to read, sorry about that.
Conversation ending timeline in the second case: So, my questions:
- Why does the error occur? Sender didn't get confirming that target has acknowledged... but why sender tried to send another one message and what it tried to acknowledge? This is not an isolated case - I get these error for some conversations in our environment.
- Does this affect something or not? I mean, errors occur when I finish conversations and then I see proper statuses in sys.conversation_endpoints. More precisely there is no record on sender side and there is an record with "closed" status on target side after I get the error