Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8215163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:41:36+00:00 2026-06-07T11:41:36+00:00

I have a web site that is using Linq2Sql on the server side. Every

  • 0

I have a web site that is using Linq2Sql on the server side.

Every now and then (haven’t yet identified the trigger) the whole web site locks up due to an open transaction. I can see the blocking process in master..sysprocesses, from which I can identify that the process ID doing the locking is the IIS process of my web site, open_tran is 1, and using DBCC inputbuffer I can see the query, which is simply a generic select ... from MyTable, which is the SQL generated by Linq2Sql when loading an object. At any rate, it’s certainly not any SQL that I wrote.

I have scanned my entire codebase for any old “BeginTransaction .. Commit/RollbackTransaction” blocks. Nada. Everything uses using (var ts = new TransactionScope()) { ... } blocks. I have attached to the IIS process and caught the Timeout exception when a query in a different thread gets blocked out. There is no other thread I can find hanging around inside a transaction block. Meanwhile the blocking process is not going away at all.

Any ideas on how to troubleshoot this further?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:41:38+00:00Added an answer on June 7, 2026 at 11:41 am

    First make sure you investigate the obvious: when such a transaction exists, attach debugger to your ASP process and check all threads, make sure there is no thread blocked/spinning inside a transaction scope. If you use async ADO.Net calls (.BeginExecuteReader) is more complicated, but given that you use LINQ is very unlikely you use async DB calls.

    IMHO the most likely cause is a deadlock situation in which the deadlock chain completes inside the client process (in your ASP.Net process). This requires some form of locking in the client (eg. C#’s lock) and it happens when a thread holding a lock goes into the DB and blocks, while another thread that has the DB lock blocking the first thread is executing in the client wants the hold by the first thread. IS a deadlock, but the chain loop involves alock in SQL Server and another lock in the client process, so it cannot be detected by SQL Server’s deadlock monitor. The very author of this site had run into this issue, so it can happen to anybody. Well, anybody who does expensive-possible-blocking outside calls like DB calls while holding a process lock, which is the first rule of DO NOT DO IT in multithreaded programming… I diverge. Even if you do not have explicit locks in your app, there are compoenents that do have such locks, eg. Log4Net. Attaching the debugger to the process, as recommended above, would show the issue.

    Another apossible suspect could be transaction enrolement into distributed transaction. TransactionScope has this nasty habit of elevating to distributed transaction when multiple connections (eg. multiple Linq data contexts) are used whithin a single transaction scope, see System.Transactions Integration with SQL Server (ADO.NET). A distributed transaction in turn has this nasty property of persisting even after the client committed and disconnected. It has to be acknowledged by the transaction coordinator before SQL Server can actually commit it ‘for good’. When in such a state, you can inspect sys.dm_tran_active_transactions and it will show up as dtc_state 2 (PREPARED). Further investigation, if this turns out to be the case, would require MSDTC troubleshooting.

    Finaly, a word of caution: why does asimple SELECT hold on to the locks? Are you using the harmful default constructor form new TransactionScope()? This would use the default SERIALIZABLE isolation level, which is a 99% times overkill and actually harmful. Try using explicit TransactionOptions and set the isolation level to ReadCommitted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've have a web site I'm building using NodeJS, that needs to serve up
I have been using the 'Web Site Administration Tool' that you can bring up
I am using ColdFusion 9.0.1. I have a new web site that uses Bikes.cfm
I have an MVC 2.0 web site that is using Areas. When I go
I have a mvc web site that contains one non-mvc page (it is using
I have a solution that includes a Web Site (created using the web site
I have a product admin web site that has been generated using ASP.NET Dynamic
I have a VS 2005 web site that I publish using Publish Web Site,
I have inherited a web site that has all of the paths set using
I have a web site using apache httpd as the server and mysql as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.