deadlock

TerminateProcess and deadlocks

Is it real that the TerminateProcess function in Windows could hang because the threads inside the process were stuck in a deadlock? Example: Process A is running under Process B's control, now Process A gets into a deadlock and Process B detects this and decides to 'Kill' process A using TerminateProcess. Would it be successful in ki...

Getting deadlocks in MySQL

We're very frustratingly getting deadlocks in MySQL. It isn't because of exceeding a lock timeout as the deadlocks happen instantly when they do happen. Here's the SQL code that is executing on 2 separate threads (with 2 separate connections from the connection pool) that produces a deadlock: UPDATE Sequences SET Counter = LAST_INSERT...

TransactionScope Prematurely Completed

I have a block of code that runs within a TransactionScope and within this block of code I make several calls to the DB. Selects, Updates, Creates, and Deletes, the whole gamut. When I execute my delete I execute it using an extension method of the SqlCommand that will automatically resubmit the query if it deadlocks as this query could ...

Delete Stored Proc Deadlock in Sql Server

I am having the following deadlock in SQL Server 2005 with a specific delete stored proc and I can't figure out what I need to do to remedy it. <deadlock-list> <deadlock victim="processf3a868"> <process-list> <process id="processcae718" taskpriority="0" logused="0" waitresource="KEY: 7:72057594340311040 (b50041b389fe)" waittime="6...

Does my GetEnumerator cause a deadlock?

I am starting to write my first parallel applications. This partitioner will enumerate over a IDataReader pulling chunkSize records at a time from the data-source. TLDR; version private object _Lock = new object(); public IEnumerator GetEnumerator() { var infoSource = myInforSource.GetEnumerator(); //Will this ca...

SQL Server stored procedure line number issue

Hello everyone, I am using SQL Server 2008 Enterprise. I met with issue which says line 9 of stored procedure foo is meeting with dead lock issue. My question is how to find exactly the 9th line of the stored procedure? My confusion is because of coding format issue, how to locate 9th line correctly. thanks in advance, George ...

SQL Server deadlock issue

Hello everyone, I am using SQL Server 2008 Enterprise. I am wondering whether dead lock issue is only caused by cross dependencies (e.g. task A has lock on L1 but waits on lock on L2, and at the same time, task B has lock on L2 but waits on lock on L1)? Are there any other reasons and scenarios which will cause deadlock? Are there any ...

java - question about thread abortion and deadlock - volatile keyword

Hello all, I am having some troubles to understand how I have to stop a running thread. I'll try to explain it by example. Assume the following class: public class MyThread extends Thread { protected volatile boolean running = true; public void run() { while (running) { synchronized (someObject) { ...

What trace flags are needed for detecting deadlocks

I am trying to get better information on deadlocks that are occurring in my DB. After reading this article, it's still unclear to me whether I should be using trace flag 1204, 1222 or both. ...

will such store procedure cause deadlock?

Hello everyone, I am using SQL Server 2008 Enterprise. I am wondering whether this store procedure cause deadlock if executed by multiple threads at the same time? Another question is -- is it best practices we define begin and end transaction inside store procedure, or defining begin and end transaction from client code (e.g. ADO.Net c...

Why single SQL delete statement will cause deadlock?

Hello everyone, I am using SQL Server 2008 Enterprise. I am wondering why even a single delete statement of this stored procedure will cause deadlock if executed by multiple threads at the same time? For the delete statement, Param1 is a column of table FooTable, Param1 is a foreign key of another table (refers to another primary key c...

deadlock when SQL Server transaction log ever-increase?

Hello everyone, I am using SQL Server 2008 Enterprise. I have tried that if I set SQL Server transaction log to ever increase for the related database (with no backup settings), then a single delete statement of this stored procedure will cause deadlock if executed by multiple threads at the same time? Any ideas why? For the delete sta...

Is READ UNCOMMITTED / NOLOCK safe in this situation?

I know that snapshot isolation would fix this problem, but I'm wondering if NOLOCK is safe in this specific case so that I can avoid the overhead. I have a table that looks something like this: drop table Data create table Data ( Id BIGINT NOT NULL, Date BIGINT NOT NULL, Value BIGINT, constraint Cx primary key (Date, I...

Deadlock in SQL Server 2005! Two real-time bulk upserts are fighting. WHY?

Here's the scenario: I've got a table called MarketDataCurrent (MDC) that has live updating stock prices. I've got one process called 'LiveFeed' which reads prices streaming from the wire, queues up inserts, and uses a 'bulk upload to temp table then insert/update to MDC table.' (BulkUpsert) I've got another process which then rea...

Postgresql: Implicit lock acquisition from foreign-key constraint evaluation

So, I'm being confused about foreign key constraint handling in Postgresql. (version 8.4.4, for what it's worth). We've got a couple of tables, mildly anonymized below: device: (id, blah, blah, blah, blah, blah x 50)… primary key on id whooooole bunch of other junk device_foo: (id, device_id, left, right) Foreign key (...

Java ThreadPoolExecutor getting stuck while using ArrayBlockingQueue

Hi, I'm working on some application and using ThreadPoolExecutor for handling various tasks. ThreadPoolExecutor is getting stuck after some duration. To simulate this in a simpler environment, I've written a simple code where I'm able to simulate the issue. import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.Rej...

In a SQL XDL File, how do I read the waitresource attribute on process nodes which are deadlocking?

On SQL Server 2005, I'm getting a deadlock when updating two different keys in the same table. note from below that these two waitresources have the same beginning part, but different ending parts. waitresource="KEY: 6:72057594090487808 (d900ed5a6cc6)" and waitresource="KEY: 6:72057594090487808 (d900fb5261bb)" These two keys ar...

deadlock on a single SQL Server table

Hello everyone, I am using SQL Server 2008 Enterprise. And using ADO.Net + C# + .Net 3.5 + ASP.Net as client to access database. When I access SQL Server 2008 tables, I always invoke stored procedure from my C# + ADO.Net code. I have 3 operations on table FooTable. And Multiple connections will execute them at the same time in sequence...

SQL Server Profiler issue

Hello everyone, I am using SQL Server 2008 Enterprise and I want to use SQL Server profiler to capture deadlock event only. And when deadlock occurs and event captured, I will stop SQL Server profiler. My question is, since I launched SQL Server profiler, and before deadlock occur (event captured), any impact (more about performance im...

How can I avoid a deadlock between these two SQL statements?

I have two stored procedures running in separate threads, running on SQL Server 2005. One procedure inserts new rows into a set of tables and the other procedure deletes old data from the same set of tables. These procedures are running into a deadlock on the tables DLevel and Model. Here is the schema: Table DFile: Primary Key = D...