deadlock

How commonly do deadlock issues occur - in programming - not in the databases?

I've programmed in a number of languages but am not aware of deadlocks in my code. I took this to mean it doesn't happen. Does this happen frequently enough that I should be concerned about it? (I'm not even sure what to check.) ...

What kinds of concurrency/deadlock issues should one be aware of in Rails code?

I've just come to a realization about deadlocks - namely what they are - and I'm concerned about this issue affecting my Rails code. Are there any specific deadlock issues to watch out for while developing a Rails app? Have you ever encountered a deadlock in your Rails code - or is that even possible? (I'm not referring to database de...

Simple Deadlock Examples

Hello, I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous 4 cars). There are also classic easily-deadlocked problems like The Dining Philosophers, but these may be too complex for a real newbie to fully grasp. I'm loo...

Can you force a SQL Stored Procedure to take locks in a given order

I have two stored procedures, one of which is called a lot and is thus very simple and executes well. Additionally, these actually work very nicely in paralell even though they are serializable. However I have a second query that is only called in certain circumstances which needs to do many more checks before touching the same tables....

Table locked during inserts... website unusable (sql server 2008)

I have a background process that is constantly inserting into a table in real-time. It could be thousands of inserts an hour (with a few updates). This same table is used by the web application to get some data needed to display to the user. Currently whenever the background process runs its inserts/updates, the web app seems blocked a...

Is the C# "lock" construct rendered obselete by Interlocked.CompareExchange<T>?

Summary: It seems to me that: wrapping fields representing a logical state into a single immutable consumable object updating the object's authoritative reference with a call to Interlocked.CompareExchange<T> and handling update failures appropriately provides a kind of concurrency that renders the "lock" construct not only unnecess...

SqlServer 2005: deadlock problem with no shared records

I have a deadlock problem with two transactions that do not access any common records. There is also no lock escalation. So I can't explain why a deadlock is possible. The deadlock occurs when two such transactions are executed at the same time: begin transaction update A set [value] = [value] where id = 1; /* resp. 2 */ /* synchroni...

SQL Server 2005 Deadlock Problem

I’m running into a deadlock problem when trying to lock some records so that no process (Windows service) picks the items to service them, then update the status and then return a recordset. Can you please let me know why am I getting the deadlock issue when this proc is invoked? CREATE PROCEDURE [dbo].[sp_LoadEventsTemp] ( @Request...

Does the MSDN example usage of ReaderWriterLockSlim contain deadlock risk?

I'm using a ReaderWriterLockSlim to protect access to the cache on my ASP.NET application. MSDN has examples of using the lock. However this article http://www.nobletech.co.uk/Articles/ReaderWriterLockMgr.aspx has me worried about deadlocks. Is this really a risk? Should the MSDN documentation mention this? public string Read(int key) {...

DeadLock Issues in Process.StandardOutput.ReadToEnd();

I read that this portion of code can cause deadlock: Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "Write500Lines.exe"; p.Start(); p.WaitForExit(); string output = p.StandardOutput.ReadToEnd(); Because A deadlock condition can result if ...

BlockedLinkedQueue deadlock inside synchronized method

This could be a newbie question - I am running into a deadlock situation while using BlockedLinkedQueue - Here is a snipped of my code: public class mytest { private BlockedLinkedQueue myQueue; public synchronized void consumer() { ... myQueue.take() ... } public synchronized void producer() { ...

Two BlockingQueue - deadlock

I have a requirement to manipulate two queues atomically and am not sure what is the correct synchronization strategy: This is what I was trying: public class transfer { BlockingQueue firstQ; BlockingQueue secondQ; public moveToSecond() { synchronized (this){ Object a = firstQ.take(); secondQ.put(a) } } public moveToFirst() { synchron...

Shared memory access without semaphores

Hi All, using shared memory apis in linux, If I have one write(by A process) and only one read( by B process) do I still need semaphore.?. Is there a example to show, using sharing memory without semaphore will get into deadlock state in linux. ...

Problem with synchronized collections of Java when doing equals() in the reverse order from multiple threads

Example scenario: Create two SynchronizedSets (s1 and s2) Pass them to two threads (T1 and T2) Start the threads T1's run() : while (forever) s1.equals(s2) T2's run() : while (forever) s2.equals(s1) What happens? - SynchronizedSet's equals acquires lock on itself It computes the length of the param that's passed in an...

Question About Deadlock Situation in Java

I'm learning about deadlocks in Java, and there's this sample code from Sun's official tutorial: Alphonse and Gaston are friends, and great believers in courtesy. A strict rule of courtesy is that when you bow to a friend, you must remain bowed until your friend has a chance to return the bow. Unfortunately, this rule doe...

How can I catch Sybase bcp errors reliably?

We're using named pipes with Sybase bcp so that we can compress output on-the-fly. This is a paraphrase of the error handling idiom, some error checking in the non-bcp parts of the script has been removed to shorten the example. while : do { rm -f $fifo mkfifo $fifo cat $fifo & CatPid=$! b...

duplicacy problems while creating a sudoku puzzle

I am trying to create my own normal 9x9 sudoku puzzle. I divided the problem into two parts - creating a fully filled sudoku, and removing unnecessary numbers from the grid Right now, I am stuck with the first part. This is the algorithm I use in brief: a) first of all I choose a number (say 1), generate a random cell position,...

Does this stack dump indicate that I have a deadlock ?

I have a REST service built using Jersey. When I performed a "curl" against my REST API, the command hangs. I ran jstack & this is a summarized output of two threads in BLOCKED state. "pool-2-thread-11" prio=6 tid=0x01d51800 nid=0x2394 waiting for monitor entry [0x05e6f000..0x05e6fce8] java.lang.Thread.State: BLOCKED (on object moni...

IPhone SendDelegateMessage failed to return after waiting 10 Secs

Hi, I keep getting the following message from my iPhone 3.0 when trying to convert a large NSData object into base64Encoding for http transmission : void SendDelegateMessage(NSInvocation*): delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode If you were not using the touch screen for this entire...

Getting deadlocks in sqlserver

I am getting deadlocks occasionally in sql server. I created a function for locking non database operations (credit card processing) so duplicates cannot happen. My functions are as follows (sorry for the tcl, but the sql is clear enough). Can anyone see why a deadlock happens occasionally????? proc ims_syn_lock_object { db object {time...