deadlock

Diagnosing Deadlocks in SQL Server 2005

We're seeing some pernicious, but rare, deadlock conditions in the Stack Overflow SQL Server 2005 database. I attached the profiler, set up a trace profile using this excellent article on troubleshooting deadlocks, and captured a bunch of examples. The weird thing is that the deadlocking write is always the same: UPDATE [dbo].[Posts] S...

Database: What is Multiversion Concurrency Control (MVCC) and who supports it?

Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it? updated: these support it (which others?) oracle postgresql ...

What is a deadlock?

When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My question to the community, is: What is a deadlock? How do you detect them? Do you handle them? And finally, how do you prevent them from occurring? ...

How to start coding the "Dining Philosophers Problem" simulation?

I'm not a beginner at C# but I really need to increase my understanding, so I've picked a classic deadlock problem to code to help teach myself some of the more advanced concepts of C#. The Dining Philosophers Problem seems like a good one, but I need a little help to get started. I know I need to approach the "diners" as objects, but ...

SQL Server 2000 - Debugging Deadlocks

I'm looking for suggestions on how to debug and chase down deadlock issues in an SQL Server 2000 database. I've had it recommended to me to use trace flags 1024 and 3605, which I have found give me the following: 1024 - this trace flag returns the type of locks participating in the deadlock and the current command affected. 3605 - th...

What are the problems of using transactions in a database?

From this post. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you define them? EDIT: Deadlock is another problem, but data inconsistency migh...

ID-ing Deadlocks in a Thread using Firebird

Developer looking for best method to identify a deadlock on a specific transaction inside a specific thread. We are getting deadlock errors but these are very general in FB 2.0 Deadlocks happening and they are leading to breakdowns in the DB connection between client and the DB. We send live ( once a second) data to the DB. We open a ...

Deadlock in ThreadPool

I couldn't find a decent ThreadPool implementation for Ruby, so I wrote mine (based partly on code from here: http://snippets.dzone.com/posts/show/3276 , but changed to wait/signal and other implementation for ThreadPool shutdown. However after some time of running (having 100 threads and handling about 1300 tasks), it dies with deadlock...

Diagnosing Deadlocks in Win32 Program

What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished? ...

Zero SQL deadlock by design - any coding patterns?

I am encountering very infrequent yet annoying SQL deadlocks on a .NET 2.0 webapp running on top of MS SQL Server 2005. In the past, we have been dealing with the SQL deadlocks in the very empirical way - basically tweaking the queries until it work. Yet, I found this approach very unsatisfactory: time consuming and unreliable. I would ...

How to stop right click dead-locking Visual Studio 2008

I have a very serious problem with Visual Studio 2008. Occasionally when I right-click (for go to definition, set next statement etc) when I'm debugging, Visual Studio will just dead-lock and go into not responding mode. Has anyone had the same problem? Does anyone know how to solve it? Edit: I'm using SP1 with a couple of hot-fixes. ...

Can I create a Database Deadlock test in Nunit?

In this asp.net I'm cleaning up it's possible for deadlocks to occur. I want to make sure that the code deals with them properly, so I'm trying to write NUnit tests which trigger a deadlock..... The DAO is split by entity. Each entity has a set of tests which are surrounded by Startup() and Teardown() methods which create a transactio...

Recursive Lock (Mutex) vs Non-Recursive Lock (Mutex)

POSIX allows mutexes to be recursive. That means the same thread can lock the same mutex twice and won't deadlock. Of course it also needs to unlock it twice, otherwise no other thread can obtain the mutex. Not all systems supporting pthreads also support recursive mutexes, but if they want to be POSIX conform, they have to. Other APIs ...

Deadlock in Java

Long time ago, I saved a sentence from a Java reference book: "Java has no mechanism to handle deadlock. it won't even know deadlock occurred." (Head First Java 2nd Edition, p.516) So, what is about it? Is there a way to catch deadlock case in Java? I mean, is there a way that our code understands a deadlock case occurred? ...

How can I Cause a Deadlock in MySQL for Testing Purposes

I want to make my Python library working with MySQLdb be able to detect deadlocks and try again. I believe I've coded a good solution, and now I want to test it. Any ideas for the simplest queries I could run using MySQLdb to create a deadlock condition would be? system info: MySQL 5.0.19 Client 5.1.11 Windows XP Python 2.4 / MySQ...

Classic ASP: Can the "Application" global object cause dead lock?

In classic ASP there is a global object called "Application" that is accessed simultaniously by all sessions. As the "Application" object is a shared resource, can it cause dead locks? EDIT: If not, why does it has lock and unlock methods for? Reference ...

How do I find the lockholder (reader) of my ReaderWriterLock in windbg

I've got a dump of a .Net process that has hung due to a deadlock (the gui thread is no longer responding, and my logs show that some threads have stopped responding). I have taken a snapshot and am now looking through it in windbg, and all threads bar one are waiting for the last one. Looking at that one thread's stacktrace with !clrsta...

How to get efficient Sql Server deadlock handling in C# with ADO?

I have a class 'Database' that works as a wrapper for ADO.net. For instance, when I need to execute a procedure, I call Database.ExecuteProcedure(procedureName, parametersAndItsValues). We are experiencing serious problems with Deadlock situations in SQL Server 2000. A part of our team is working on the sql code and transactions to mini...

Reduce deadlock on PAGE level on update query on MS SQL

I have some funny deadlock caused by a stupid simple SQL UPDATE query, on a flat plain table, under default "READ COMMITED" transaction. UPDATE table SET column=@P1 WHERE PK=@P2; While PK varchar(11), has a clustered index on it. no trigger or table relation..etc on the table. I did some check and find that the deadlock happen ...

eof detection for DirectShow

Is there a way to detect that a DirectShow filtergraph has reached the end of its file? By end of its file, I mean that a filtergraph with a SampleGrabber filter will never receive another SampleCB call. Here are some things that don't work: Trust IMediaDet::get_StreamLength (it's often says there are more frames in a video than real...