deadlock

Programmatic deadlock detection in java

How can I programmatically detect that a deadlock has occurred in a Java program? ...

What type of diagram is best suited for visualizing threading issues such as contentions?

While debugging an issue with our system, I have discovered a thread contention that is causing a bottleneck. I need to explain the phenomenon to other people involved in handling this issue. Some of them are not from development team (yet, they are reasonably technical). So what type of diagrams can be used to depict threading issues...

Sybase ASE: "Your server command encountered a deadlock situation"

Hello, When running a stored procedure (from a .NET application) that does an INSERT and an UPDATE, I sometimes (but not that often, really) and randomly get this error: ERROR [40001] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Your server command (family id #0, process id #46) encountered a deadlock situation. Please ...

Deadlock in 3rd Party dll

I'm using (and referencing) two 3rd party dlls (a.dll, and b.dll) in two of my C# applications. I'm getting a repeatable problem where both applications hang while making a call to a function in the 3rd party library. I tried to make a copy of a.dll and b.dll (a2.dll, and b2.dll) and use that in the second application, but it turns out...

How to debug a deadlock?

Other than that I don't know if I can reproduce it now that it's happened (I've been using this particular application for a week or two now without issue), assuming that I'm running my application in the VS debugger, how should I go about debugging a deadlock after it's happened? I thought I might be able to get at call stacks if I paus...

Java deadlockprovocation

I'm doing some excercises with java (some of you may suppose where the code comes from). I try to provocate a deadlocksituation with the following code: class Resource { public Integer value = 42; } public class DeadLockRisk implements Runnable { private Resource resourceA = new Resource(); private Resource resourceB = ne...

PostgreSQL exclusive lock stops application.

My applications tests are pretty hard on the database. They run create, drop and alter table statements. However, I would still expect postresql to handle these even in the case of a deadlock (i.e detect the lock and trow one thread out). I am not running requests concurrently either. However, in my case it just freezes and I have to m...

How to solve insert/delete deadlock on non-clustered index?

I got a deadlock problem and I found that it's caused by two stored procedures that is called by different threads (2 called web services). Insert sp that insert data in X table. Delete sp that delete data in X table. Moreover, I got result that told me about deadlock happened in non-unique and non-clustered index of X table. Do you ...

How to detect deadlock ? Timeout in synchronized block?

I’m debugging a Java application that runs several threads. After a while of watching the log it seems that one of those threads is not running anymore. My guess is that the thread is waiting for a lock that is never released (the last output is before calling a synchronized method). Can I configure a timeout to the thread; a sort of “...

Deadlock on a single java semaphore?

In one of my recent answers, I gave a theoretical semaphore example of limiting access to memory resources: public static byte[] createArray(int size) throws InterruptedException { semaphore.acquire(size); return new byte[size]; } public static void releaseArray(byte[] array) { semaphore.release(array.length); } I think th...

Lock Free Array Element Swapping

In multi-thread environment, in order to have thread safe array element swapping, we will perform synchronized locking. // a is char array. synchronized(a) { char tmp = a[1]; a[1] = a[0]; a[0] = tmp; } Is it possible that we can make use of the following API in the above situation, so that we can have a lock free array ele...

Hibernate / DB2 -913 deadlock

An application deployed on several machines - accesses the same DB Table. It reads the MIN row and then deletes that row. When this happens concurrently, we get a -913 error from DB2 signifying deadlock. Have tried following options already 1. locks on row. 2. re-try mechanism in application code, after the deadlock occurs. Nothing se...

How to predict deadlocks in java

I am looking for a tool which can predict deadlocks in java before the occur. I tried to use MTrat but failed (maybe it does not supports Sun Hotspot JVM so well) Does someone have a good tool for this purpose? ...

Deadlocks on MySQL deleting rows

We have a (currently InnoDB) table which contains roughly 500,000 rows. This represents a queue of tasks to run. It is stored in a MySQL database. An a continual basis, at least once per second but sometimes more frequently, we select data from it and subsequently update some rows. Once per day, we prune old rows from the table. We ...

some good tutorials about SQL Server deadlock?

Hello everyone, I am learning SQL Server deadlock, about why there is deadlock, how to solve dead lock issue, best practices, how to analyze why deadlock happens. I am working on SQL Server 2008 Enterprise. Any recommended readings for me? thank in advance, George ...

sql server 2005 deadlock times out in production, not in test environment: why?

Hi all, In my development environment, I seek to recreate a production issue we face with MSSQL 2005. This issue has two parts: The Problem 1) A deadlock occurs and MSSQL selects one connection ("Connection X") as the 'victim'. 2) All subsequent attempts to use "Connection X" fail (we use connection pooling). MSSQL says "The server fa...

ContextSwitchDeadlock when running unit (integration) tests

We get the following error when running at test: ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from COM context 0x344b0c0 to COM context 0x344b230 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running op...

Multiprocessing debug techniques

I'm having trouble debugging a multi-process application (specifically using a process pool in python's multiprocessing module). I have an apparent deadlock and I do not know what is causing it. The stack trace is not sufficient to describe the issue, as it only displays code in the multiprocessing module. Are there any python tools, or...

How to change locking strategy in SQL Server?

I've read articles like these: http://www.codinghorror.com/blog/archives/001166.html http://www.databasejournal.com/features/mssql/article.php/3566746/Controlling-Transactions-and-Locks-Part-5-SQL-2005-Snapshots.htm And from what I understand, SQL Server has a very pessimistic locking strategy. And to improve performance, I should chang...

Why is lockless concurrency such a big deal (in Clojure)?

I'm told that Clojure has lockless concurrency and that this is Important. I've used a number of languages but didn't realize they were performing locks behind the scenes. Why is this an advantage in Clojure (or in any language that has this feature)? ...