Wednesday, March 21, 2012

Problem with ServiceBroker

I use 2 SQL Server: 1 – SQL Server 2005 Enterprise on Windows Server 2003 (Itanium) and SQL Server Express on Windows XP Professional (Pentium).

I send the message from enterprise to express the message (at once I shall tell, that sending of the message in the opposite direction gives the same result) and I process the message on express. At first sight like all is correct. Messages I receive all, I read also all of them are correct. But further there are two strange things for me.

In the table sys.conversation_endpoints there is a record (one, irrespective of how many messages in one conversation) with “state=CD”. I read that they should be deleted after 30 minutes, but they did not. Using command … WITH CLEANUP helps but in a parallel way in Service Broker Profiler I observe occurrence of a mistake which occurs after closing dialogue.

I am disturbed with this mistake and the most important is that I not understand why it arises.

EXPRESS

Event Class

EventSubClass

TextData

Broker:Message Classify

1 - Local

Broker:Conversation Group

1 - Create

Broker:Conversation

12 - Dialog Created

STARTED_INBOUND

Broker:Conversation

6 - Received Sequenced Message

CONVERSING

Broker:Remote Message Acknowledgement

3 - Message with Acknowledgement Received

Broker:Conversation

6 - Received Sequenced Message

CONVERSING

Broker:Remote Message Acknowledgement

3 - Message with Acknowledgement Received

Broker:Conversation

7 - Received END CONVERSATION

DISCONNECTED_INBOUND

Broker:Remote Message Acknowledgement

3 - Message with Acknowledgement Received

Broker:Activation

1 - Start

Broker:Message Classify

2 - Remote

Broker:Remote Message Acknowledgement

2 - Acknowledgement Sent

Broker:Conversation

2 - END CONVERSATION

CLOSED

Broker:Conversation Group

Broker:Activation

2 - Ended

Broker:Connection

4 - Closing

An error occurred while receiving data: '64(error not found)'.

Broker:Connection

5 - Closed

Enterprise

Event Class

EventSubClass

TextData

Broker:Conversation Group

1 - Create

Broker:Conversation

11 - BEGIN DIALOG

STARTED_OUTBOUND

Broker:Conversation

1 - SEND Message

CONVERSING

Broker:Message Classify

2 - Remote

Broker:Conversation

1 - SEND Message

CONVERSING

Broker:Message Classify

2 - Remote

Broker:Conversation

1 - SEND Message

CONVERSING

Broker:Message Classify

2 - Remote

Broker:Conversation

2 - END CONVERSATION

DISCONNECTED_OUTBOUND

Broker:Conversation Group

2 - Drop

Broker:Message Classify

2 - Remote

Broker:Message Classify

2 - Remote

Broker:Remote Message Acknowledgement

1 - Message with Acknowledgement Sent

Broker:Remote Message Acknowledgement

1 - Message with Acknowledgement Sent

Broker:Remote Message Acknowledgement

1 - Message with Acknowledgement Sent

Broker:Message Classify

1 - Local

Broker:Conversation

10 - Received END CONVERSATION Ack

CLOSED

Broker:Remote Message Acknowledgement

4 - Acknowledgement Received

Broker:Connection

4 - Closing

Broker:Connection

5 - Closed

Yours faithfully,

From what I understand, you are doing a BEGIN DIALOG, followed by two SENDs and then END DIALOG, all from the initiator side (the enterprise instance).

The target side (express) is just passively receiving the messages, reacting with an END CONVERSATION itself when the it receives the END CONVERSATION message from the initiator.

In general, this pattern of BEGIN DIALOG/SEND/END (aka 'fire and forget') is not advisable. If the messages cannot be delivered (e.g. the target denies access to the service), the initiator never knows about this, since he already ended the conversation. My recomendation is to have the target end the dialog first, after receiving the two messages, and the initiator END CONVERSATION on it's turn as a reaction of receiving the end dialog message from target. Another side effect of this pattern of messages (when target never sends any message back) is that the target endpoint doesn't get deleted, and that is the problem you're seeing. This is a known issue and will be addressed in a next release.

If you're asking about the reason for the 'An error occurred while receiving data: '64(error not found)', this is simply because the connection between the two machines is timing out due to innactivity. One side will time out first (the enterprise in this case) and close the connection, the other side simply reports the fact that the connection was closed by the peer.

HTH,
~ Remus

No comments:

Post a Comment