Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deadlocks when running NServicebus service causes corrupt connection

We're running NServiceBus for a web application to handle situations where the user do "batch like" actions. Like fire a command that affects 1000 entities..

It works well, but during moderate load we get some deadlocks, this isn't a problem, just retry the message.. right? :)

The problem occurs when the next message arrives and tries to open a connection. The connection is then "corrupt".

We get the following error: System.Data.SqlClient.SqlException (0x80131904): New request is not allowed to start because it should come with valid transaction descriptor

I've searched the web and I think our problem is a reported NH "bug":

A workaround should be to disable connection pooling. But I don't like that, since performce will degrade..

We're running NServiceBus 2.6, NHibernate 3.3.

Does anyone have any experience with this? Can a upgrade of NServiceBus help?

like image 580
Erik Sundström Avatar asked Nov 12 '22 09:11

Erik Sundström


1 Answers

I’ve seen this in the past, if your design warrants, try breaking the transaction into two, if you flow the message transaction all the way to your database operations, any failures will have a cascading effect and it will impact (ideally it shouldn’t) any subsequent messages as well.

like image 58
Yakaas Avatar answered Dec 12 '22 12:12

Yakaas