SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Service Broker Transactions


Service Broker Transactions

Author
Message
venoym
venoym
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2383 Visits: 2082
Comments posted to this topic are about the item Service Broker Transactions
Keld Laursen (SEGES)
Keld Laursen (SEGES)
Mr or Mrs. 500
Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)Mr or Mrs. 500 (548 reputation)

Group: General Forum Members
Points: 548 Visits: 212
Good question. Thanks.
Although I had never used BrokerSend before, I had done something similar on linked servers, ending up in the same error.
Konstantin Reu
Konstantin Reu
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2865 Visits: 813
Good question!

Explained situation is known as "Uncommitable transaction".

MS SQL 2008 MCITP x 3
MS SQL 2012 MCSE x 2
Tom Thomson
Tom Thomson
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43684 Visits: 12993
Interesting question. I haven't a clue in this area of SQL Server, but it looked like a choice between option 1 and option 3 (option 4 had to be a joke - if it were that it would be famous, but it isn't famous so it isn't that; and option 2 seemed too silly for words). Option 1 was less bizarre, so I chose that and got it wrong.

The trouble is that even with the explanation and a bit of background reading, I still don't understand it; so obviously I have a lot more reading to do. I guess that means that this QoTD will result in a fair chunk of learning, so it must be a good question.

Tom

venoym
venoym
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2383 Visits: 2082
Yes, option 4 is a joke.

This is an uncommittable transaction, you can see outlined in the linked BOL on TRY CATCH with Transactions. I ran into the issue because of an error in a production situation where the massively complicated stored procedure started throwing the "unable to write" exception about 1 time per week. Fortunately a coworker managed to reproduce in house and we were able to identify that the Dialog ID (or conversation id) was what was invalid and causing everything else.

Working with Service Broker and XML data types can be VERY tricky when dealing with transactions as everything is a severity 16 error which causes the Uncommittable Transaction condition.
Stephanie Giovannini
Stephanie Giovannini
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4016 Visits: 1549
So, how would you fix the posted code so that the uncommittable transaction message isn't reported?

I'm curious which COMMIT statement is causing the error. There's a COMMIT statement after the CATCH block inside the proc, and also a COMMIT in the outer transaction.

I suppose one (or both) of these should check XACT_STATE() before executing?
Sean Lange
Sean Lange
SSC Guru
SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)SSC Guru (125K reputation)

Group: General Forum Members
Points: 125428 Visits: 18395
I also don't have any experience in this part of sql but like I Tom I kind of guesses it would be 1 or 3. However answer #4 was just way too funny so I had to pick that to make sure that at least 1 person did. :-D

Interesting question about a topic I am totally unfamiliar with. Will have to come back and read on this when I get a chance.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Mark Cowne
Mark Cowne
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12574 Visits: 26348
Interesting question. I guessed ... and guessed wrong

____________________________________________________

Deja View - The strange feeling that somewhere, sometime you've optimised this query before

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537




venoym
venoym
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2383 Visits: 2082
Stephanie Giovannini (3/2/2012)
So, how would you fix the posted code so that the uncommittable transaction message isn't reported?

I'm curious which COMMIT statement is causing the error. There's a COMMIT statement after the CATCH block inside the proc, and also a COMMIT in the outer transaction.

I suppose one (or both) of these should check XACT_STATE() before executing?


The easiest method to fix the error that prompted this question is to check for the Dialog ID (or Conversation ID) in the sys.conversation_endpoints system table (or view?). The error is not at a commit statement, rather at the INSERT INTO dbo.[BrokerErrors] is where it throws the Severity 16, unable to perform operations that write to the log.

Order of Exceptions:
1. SEND exception (Severity 16)
2. INSERT INTO (Severity 16) <-- this is returned to the calling SP/App, aka answer 3
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)SSC Guru (123K reputation)

Group: General Forum Members
Points: 123036 Visits: 18626
Thanks for the question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search