deadlock

Solving a SQL Server Deadlock situation

I am trying to find a solution that will resolve a recurring deadlock situation in SQL server. I have done some analysis on the deadlock graph generated by the profiler trace and have come up with this information: The first process (spid 58) is running this query: UPDATE cds.dbo.task_core SET nstate = 1 WHERE nmboxid = 89 AND...

how to avoid deadlock in mysql

I have the following query (all tables are innoDB) INSERT INTO busy_machines(machine) SELECT machine FROM all_machines WHERE machine NOT IN (SELECT machine FROM busy_machines) and machine_name!='Main' LIMIT 1 Which causes a deadlock when I run it in threads, obviously bec...

Why does ffmpeg stop randomly in the middle of a process?

ffmpeg feels like its taking a long time. I then look at my output file and i see it stops between 6 and 8mbs. A fully encoded file is about 14mb. Why does ffmpeg stop? My code locks up on StandardOutput.ReadToEnd();. I had to kill the process (after seeing it not move for more then 10 seconds when i see it update every second previously...

Why are these two sql statements deadlocking? (Deadlock graph + details included).

Hi folks, I've got the following deadlock graph that describes two sql statements that are deadlocking each other. I'm just not sure how to analyse this problem and then fix up my sql code to prevent this from happening. Main deadlock graph Click here for a bigger image. Left side, details Click here for a bigger image. Right sid...

SQL deadlock on delete then bulk insert

I have an issue with a deadlock in SQL Server that I haven't been able to resolve. Basically I have a large number of concurrent connections (from many machines) that are executing transactions where they first delete a range of entries and then re-insert entries within the same range with a bulk insert. Essentially, the transaction lo...

Java synchronized seems ignored

Hi, I've got the following code, which I expected to deadlock after printing out "Main: pre-sync". But it looks like synchronized doesn't do what I expect it to. What happens here? import java.util.*; public class deadtest { public static class waiter implements Runnable { Object obj; public waiter(Object obj) { ...

Are all deadlocks caused by a bad query

"Transaction (Process ID 63) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly." ...

BDE, Delphi, ODBC, SQL Native Client & Dead lock

Hi. We have some Delphi code that uses the BDE to Access SQL Server 2008 through the SQL Server Native Client ODBC driver (2005 version). Our issue is that we're experiencing some deadlock issues in a loop doing inserts to multiple tables. The whole loop is done within a [TDatabase].StartTransaction. Looking at the SQL Server Profil...

How to troubleshoot ORA-02049 and lock problems in general with Oracle

I am getting ORA-02049 occasionally for some long-running and/or intensive transactions. There is seemingly no pattern to this, but it happens on a simple INSERT. I have no clue how to get any sort of information out or Oracle, but there has to be a way? A log over locking or atleast a way to see current locks? ...

Tree structures and threads

I have a speed critical multithreaded program which involves data in a tree structure. Implemented as follows: typedef struct { // data pertaining to linkages, defining the architecture of the tree int parent_node; int child_node[MAX_CHILD_NODES]; int number_of_children; // data pertaining to info at each node f...

Cooperative/Non-preemptive threading avoiding threadlooks?

Any creative ideas to avoid deadlocks on a yield or sleep with cooperative/non-preemptive multitasking without doing an O/S Thread.Sleep(10)? Typically the yield or sleep call will call back into the scheduler to run other tasks. But this can sometime produce deadlocks. Some background: This application has enormous need for speed and,...

Python calling pipe.communicate() in a thread

Using Python 2.6.1 on Mac OS X 10.6.2, I've the following problem: I have a threaded process (a Thread class), and each of those threads has a pipe (a subprocess.Popen) something likeso: from threading import Thread cmd = "some_cmd" class Worker(Thread): def run(self): pipe = Popen(cmd, stdin=PIPE, stdou...

Deadlock sample in .net?

Can anybody give a simple Deadlock sample code in c# ? And please tell the simplest way to find deadlock in your C# code sample. (May be the tool which will detect the dead lock in the given sample code.) NOTE: I have VS 2008 ...

SQL Server 2008 Dead lock issue

I got into a deadlock issue where I am struggling find the root-cause...The Deadlock graph suggests that an UPDATE statement became the victim over a SELECT statement... What puzzles me is that the UPDATE statement is trying to acquire an index on some other table that is never referred in update statement... This is how my UPDATE state...

MySQL return Deadlock with insert row and FK is locked 'for update'

Hello developers! I get deadlock error in my mysql transaction. The simple example of my situation: Thread1 > BEGIN; Query OK, 0 rows affected (0.00 sec) Thread1 > SELECT * FROM A WHERE ID=1000 FOR UPDATE; 1 row in set (0.00 sec) Thread2 > BEGIN; Query OK, 0 rows affected (0.00 sec) Thread2 > INSERT INTO B (AID, NAME) VALUES (1000,...

What is the point to put deadlock code ahead of JSON in HTTP response?

When sniffing Gmail and Facebook traffic, I found there are leading deadlock code before JSON response of XmlHttpRequest. For example for (;;);{"t":"continue"} and while(1); [["v","nW3OxUDq0kU.en.","8","51bec53f21305d9c"],["di",86]] What is the purpose of this "for(;;);" and "while(1);" deadlock? ...

JDBC transaction dead-lock: solution required?

My friend has described a scenario and challenged me to find solution. He is using Oracle database and JDBC connection with read committed as transaction isolation level. In one of the transactions, he updates a record, executes a select statement and commits the transaction. When everything happens within a single thread, things are fin...

Figuring out the resource a lock in SQL Server 2000 affects

I am adding a simple web-interface to show data from a commercial off the shelf (COTS) application. This COTS issues locks on any record the user is actively looking at (whether they intend to edit and update it or not). I have found sp_lock and the Microsoft sp_lock2 scripts and can see the locks, so that's all well and good. How...

Working around MySQL error "Deadlock found when trying to get lock; try restarting transaction"

Hi all: I have a MySQL table with about 5,000,000 rows that are being constantly updated in small ways by parallel Perl processes connecting via DBI. The table has about 10 columns and several indexes. One fairly common operation gives rise to the following error sometimes: DBD::mysql::st execute failed: Deadlock found when trying to...

Is it possible for competing file access to cause deadlock in Java?

I'm chasing a production bug that's intermittent enough to be a real bastich to diagnose properly but frequent enough to be a legitimate nuisance for our customers. While I'm waiting for it to happen again on a machine set to spam the logfile with trace output, I'm trying to come up with a theory on what it could be. Is there any way f...