RE: Understanding how my code is causing deadlocks!

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: AnthonyThomas (AnthonyThomas_at_discussions.microsoft.com)
Date: 11/04/04


Date: Wed, 3 Nov 2004 21:37:02 -0800

Enable trace 1204 and 3605. This will give you more info on the processes
and write that information to the Application Event log.

Sincerely,

Anthony Thomas

"Kevin Kraus" wrote:

> Hello everyone,
>
> I have a windows service that has a job of periodically pulling data from
> SQL Server and sending it to a web service. The way the service pulls the
> data is as follows:
>
> - Update statement to update batch of records (1 table) to be "pulled"
> - Select statement to pull records marked in batch (1 join to other table
> for extra data)
> - Send to Web Service
> - Update statement to update batch of records (1 table) with status of
> "pulled" (Periodic deadlocks produced here)
>
> Background on the service code and process:
> - Component instanciated by windows service to do the sql calls is a .NET
> ServicedComponent with TransactionOption.NotSupported.
> - All SQL is embedded in code.
> - First update statement and select statement are sent to SQL server in one
> call.
> - Second Update statement is made in separate sql server call
> - The host application that owns this database is out of my control and I
> don't know how it makes it's SQL calls to the resources I am trying to update.
>
> My understanding of deadlocks is that my process thread needs to have a lock
> on a resource (r1) and try to acquire another lock on a different resource
> (r2) while a different process thread has r2 locked and is trying to access
> r1 that I have locked. I don't see how I have any locks based off of my
> simple update, select, update statements.
>
> I need enlightenment on what possible locking scenarios might be causing
> these deadlocks.
>
> Thanks for your help
>
> Kevin



Relevant Pages

  • Re: UPDATE Statements May be Replicated as DELETE/INSERT Pairs
    ... I couldn't really tell what was the update statement that caused this ... Looking for a SQL Server replication book? ... Delete/Insert pairs, I was really surprised and couldn't understand ...
    (microsoft.public.sqlserver.replication)
  • RE: Understanding how my code is causing deadlocks!
    ... you can set some trace flags that will give you more detailed ... information when the deadlocks occur. ... > SQL Server and sending it to a web service. ... > - First update statement and select statement are sent to SQL server in one ...
    (microsoft.public.sqlserver.server)
  • RE: FULL TEXT SEARCH
    ... data type and length are same but I am still getting this error, I am using Sql server 2000 standard edition on windows 2000 ... Expected '_STRING' in search condition 'Kevin Durban- Jackson ... and freetext(address,'14 Marchmont Rd') AND contains ...
    (microsoft.public.sqlserver.fulltext)
  • Understanding how my code is causing deadlocks!
    ... I have a windows service that has a job of periodically pulling data from ... SQL Server and sending it to a web service. ... - Update statement to update batch of records to be "pulled" ...
    (microsoft.public.sqlserver.server)
  • Re: Error re-installing SQL Server 2005
    ... Kevin Struckhoff ... > decided to try out sql server 2008 rc0. ... Refer to server error logs and setup logs for ... For details on how to view setup logs, ...
    (microsoft.public.sqlserver.setup)