Re: Preventing deadlocks

From: David Gugick (davidg-nospam_at_imceda.com)
Date: 12/06/04


Date: Mon, 6 Dec 2004 17:15:47 -0500

Maury Markowitz wrote:
> I've noticed a couple of very nasty deadlocks on our new server
> lately, and I'd like some advice on how to "ignore" them. What's
> happening is that someone's machine and/or Access dies into the VB
> debugger in the middle of a SELECT, and the process locks. This
> pretty much stops all access to the server, and ends backups as well!
>
> I don't see any way to prevent these problems on the user machine, so
> how to I ignore them on the server? Is there some timeout I've forgot
> to set when we set up the machine?
>
> Also, when I attempt to kill the process in Manager it seems to
> either not work, or take a very long time. Is this normal?

A deadlock does not kill a connection. It only raises an error. The
server doesn't really do anything other than select the deadlock victim
and raise the error. The rest is up to the application. If you have an
application that is encountering a deadlock and locking up, then the
connection is likely remaining connected to the server. However, the
transaction is automatically rolled back by SQL Server, so it's not
clear what is causing your issue.

Are you sure you are having deadlock problems and not blocking issues?
I'm starting to think from your post that you may have confused the
terms. A deadlock is when two or more spids are requesting access to
objects that are locked by the other spids. In effect, they would all
block each other forever. So, SQL Server terminates one of the
transactions (the deadlock victim). In a blocking situation, one spid
requests a lock on a resource that is locked by another spid. Unless you
specify a lock timeout in your code, the first spid will wait forever
for the resource.

So which situation is yours?

-- 
David Gugick
Imceda Software
www.imceda.com 


Relevant Pages

  • Re: ASP.NET worker process deadlock symptoms
    ... deadlock.... ... > Yes we have tweaked settings in our machine.config file per recommendations from Microsoft. ... > So far I do not see any attributable condition to our SQL Server database. ... > the app works for a while and then gets the "Server Application ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: URGENT deadlock question
    ... I have a deadlock template that I use with the following ... > SQL: Statement Completed ... > "Trace flags remain enabled in the server until disabled by executing ...
    (microsoft.public.sqlserver.server)
  • Re: identifying deadlock conditions
    ... Is there any other way to enable the Trace flag 1204 ... Note:- You can also give the same usign SQL server enterprise manager ... "Deadlock" event in the trace file, ...
    (microsoft.public.sqlserver.server)
  • JDK Deadlocks with 2 app domains inside same aspnet_wp.exe
    ... I analyzed several thread dumps made while the server was in deadlock state, ... we have 2 threads from 2 different app domains that deadlock each other. ... I cannot even solve the deadlock by synchronizing on a global static ...
    (microsoft.public.dotnet.vjsharp)
  • Re: SQL Timeout problem
    ... the amount of buffer pool memory allocated to SQL Server ... and the amount of freely usable MEM TO LEAVE memory to use for connections. ... > The results for the "BlkBy" spid is the same. ...
    (microsoft.public.sqlserver.server)