deadlock

What are common reasons for deadlocks?

Deadlocks are hard to find and very uncomfortable to remove. How can I find error sources for deadlocks in my code? Are there any "deadlock patterns"? In my special case, it deals with databases, but this question is open for every deadlock. ...

How to output data form a thread to another thread without locking?

I'm developing a DirectShow application. I encounter a deadlock problem, the problem seems caused by acquire lock in a callback function called from a thread. This is the quest I asked in MSDN forum: http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/f9430f17-6274-45fc-abd1-11ef14ef4c6a Now I have to avoi...

Deadlock in delete-select

The following SQL statement is occasionally generating deadlocks in my mssqlserver 2000 server delete from tb_intervaloServico where idFeriado in ( select ints.idIntervalo from tb_periodicidadeServico ps, tb_intervaloServico ints where ints.idPeriodicidadeServico=ps.idPeriodicidadeServico and idservicoContrato='7f20b4...

Where does this deadlock hide?

Hi, I'm actually writing an MPI program. This is a basic client / server pattern. The server have a set of work to compute. The clients get subsets of this big set. Each client use several threads to compute the subset. I must be sure all the threads finished before requesting another subset to the server. The client is split into seve...

Deadlocks with pthreads and CreateThread

I'm using pthreads in a Windows application. I noticed my program was deadlocking--a quick inspection showed that the following had occurred: Thread 1 spawned Thread 2. Thread 2 spawned Thread 3. Thread 2 waited on a mutex from Thread 3, which wasn't unlocking. So, I went to debug in gdb and got the following when backtracing the th...

ORM Support for Handling Deadlocks

Do you know of any ORM tool that offers deadlock recovery? I know deadlocks are a bad thing but sometimes any system will suffer from it given the right amount of load. In Sql Server, the deadlock message says "Rerun the transaction" so I would suspect that rerunning a deadlock statement is a desirable feature on ORM's. ...

Log4j is hanging my application what am I doing wrong?

First some background on the application. I have an application processing many independent tasks in parallel via a thread pool. The thread pool is now hanging. The following is an snippet from my thread dumps, all my Threads in pool-2 are BLOCKED by "pool-2-thread-78". It seems to be locked trying to write to the console which I find e...

C# Multithreading issue with Monitor-class - possible lifelock?

I have a bit of code, which I can't figure out properly. The problem is that the program is multithreaded and within there is a bit of code that should be synchronized so I wrote this: lock (lockObject) { if (!Monitor.TryEnter(lockObject)) Monitor.Wait(lockObject); //do stuff... Monitor.PulseAll(lockObject); } Monitor.Exi...

How to detect deadlocks in Mysql / innodb ?

Hi, I know that deadlocks occur inevitably when using transactions in Innodb and that they are harmless if they are treated properly by the application code - "just try it again", as the manual says. So I was wondering - how do you detect deadlocks? Does a deadlock issue some special mysql error number? I am using PHP's mysqli extensio...

Lock Ordering in C3p0

I am trying to log the creation and destruction of database connections in our application using c3p0's ConnectionCustomizer. In it, I have some code that looks like this: log(C3P0Registry.getPooledDataSources()) I'm running into deadlocks. I'm discovering that C3p0 has at least a couple objects in its library that use synchronized m...

SQL Server deadlocks between select/update or multiple selects

All of the documentation on SQL Server deadlocks talks about the scenario in which operation 1 locks resource A then attempts to access resource B and operation 2 locks resource B and attempts to access resource A. However, I quite often see deadlocks between a select and an update or even between multiple selects in some of our busy ap...

Oracle Deadlock when Hibernate application loading data for readonly use

We are experiencing an Oracle Deadlock (org.hibernate.util.JDBCExceptionReporter - ORA-00060: deadlock detected while waiting for resource) error. It has been suggested that the issue is with a process that is performing readonly operations using Hibernate while another process is performing an update on the same row. The readonly proc...

Software to monitor events fired from code

I'm having trouble within a block of code that I believe is related to a mouse click event but I cannot seem to capture the exact event within my code. I've used the C# debugger to step through my code and after the end of one of my events the code simply locks up. The purpose of my post is to ask if there is any software that will watc...

ThreadPool, QueueUserWorkItem and Deadlock on Shutdown

I just implemented a thread pool like described here Allen Bauer on thread pools Very simple implementation, works fine, but my application no longer shuts down. Seems that two worker threads (and one other thread, I guess the queuing thread) stuck in the function ntdll.ZwRemoveIoCompletion I remember to have read something about IO...

Help with deadlock in Sql Server 2008

Hi, My website doesn't seem to handle a high number of visitors, I believe it's because the server is too simple. 2 hours ago my website was getting a lot of hits and I noticed that 3 deadlock errors occured, the error is: System.Data.SqlClient.SqlException : Transaction (Process ID 58) was deadlocked on lock resources with another p...

Database deadlocks

One of the classical reason we have a database deadlock is when two transactions are inserting \updating tables in a different order. e.g. Transaction A inserts in Table A then Table B and Transaction B inserts in Table B followed by A Such a scenario is always at risk of a database deadlock (assuming you are not using serializable is...

Trying to wrap my wee brain around how threads deadlock...

First, here's a sample: public class Deadlock { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } public synchronized void bow(Friend bower) { System.out.fo...

Best way to get the next id number without "identity"

I have to insert some records in a table in a legacy database and, since it's used by other ancient systems, changing the table is not a solution. The problem is that the target table has a int primary key but no identity specification. So I have to find the next available ID and use that: select @id=ISNULL(max(recid)+1,1) from subscri...

MoveWindow deadlock?

I have a window on thread A, which at some point (as a result of a message being received on its wndproc) triggers an action on thread B, and then waits for the action to complete (using some sort of sync mechanism). Thread B then calls MoveWindow(), to move a child window within thread A's window (a standard textbox, for example). At th...

InnoDB deadlock with read-uncommited! - Java - Glassfish - EJB3 (JPA/Hibernate)

Hello I'm new here and need some help :) It's been several days that i got deadlock issues on a Java application with Glassfish - EJB3 with Mysql InnoDB Config: Mysql InnoDB: Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2 Application server: Glassfish v2.1 Persistance with EJB3 - JPA - Hibernate To make i...