Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate SQL Server Suspended Processes

Have run into an issue that i am hoping somebody can help give me some direction on. Working on an application that is several years on, on .NET 3.5 and NHibernate 1.2. Have been having a problem over the past week where transaction seem to lock up randomly. I noticed NH had a command_timeout of 100000. I have now brought this down to 30 as 100000 seemed crazy! The issues are still occurring.

SQL Server Activity Monitor shows a blocking transaction when the issue occurs, normally in the SUSPENDED state. If i kill the blocking process, those processes being blocked fire off and the system is fine.

Running a check on the blocking process, i can see the approx SQL statement being executed that is causing the issue, but it's a statement that is executed through much of the system, retrieving common data across most pages.

What do I think could have caused this? Nothing obvious... we did release a couple of small changes, but none of them should have this effect. Windows updates/service packs were recently installed as well about the same time. Could SQL/.NET SP updates be the cause of this issue??

I know there is a lot here, but trying to give as much as i have at the moment.

NEW INFO: Now that the command_tinmeout has been updated to 30 seconds, queries that exceed this execution time are killed off automatically - or so i see in Activity Monitor. However, it seems as somthing else is going on, as repeat queries fail with timeout as well. However, if i stop and start the application pool, everything begins to work as per normal, at least for a while.

like image 638
TheITGuy Avatar asked Jun 26 '26 00:06

TheITGuy


1 Answers

When you say that it is a very common query that you see as the blocking one it is most likely because it is executed commonly and therefore is most likely to be the one waiting for a lock in the database.

What isolation level is the database running in, if its out of the box setting it is in most cases very feasible for performance to switch it to snapshot isolation to avoid readers waiting for writers. More info on Snapshot isolation

Considering what caused this, maybe you introduced some slow write queries, your data grew big or you have a lot of fragmentation in your data suddenly.

like image 152
jakobandersen Avatar answered Jun 28 '26 19:06

jakobandersen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!