Questions tagged [deadlock]

Situation where two (or more) operations need overlapping sets of resources, and neither can complete because they cannot obtain all locks necessary to complete an operation and release their locks.

Deadlock is situation where multiple operations are waiting for same resource(s) while simultananeously holding other resources that other threads holding the desired resources are waiting for.

For example, given resources A,B,C and processes 1,2.

  1. 1 locks A and B
  2. 2 locks C
  3. 2 needs A to finish
  4. 1 needs C to finish.

Neither 1 or 2 can release resources before finishing. Therefore, deadlock occurred.

The classical solution to all deadlock problems is to always acquire the resources in the same order in all threads or processes.

Reference

Deadlock in Wikipedia

3451 questions
1
vote
0 answers

Why parallel stream is hanging at static initialization phase

I'm preparing for OCP and have some question that really don't understand with parallel streams. Here is my code: public class Test { static long n = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .parallelStream() .map(i…
1
vote
2 answers

Strange deadlock in C# with single thread and no recursion

I am running into a strange behavior of my C# application. I am running the application in debug mode via VS2010 and after several hours the application just waits for a lock release but the only thread which is alive is the one that waits upon the…
DoronBM
  • 515
  • 1
  • 6
  • 17
1
vote
1 answer

Dead lock on SYS object during oracle EXPDP

I have an Oracle 11g and I wanted to export all my shcema objects, with this command: expdp as '/ as sysdba' directory=DIR dumpfile=DWH%U.dmp logfile=DWH.log filesize=40000m parallel=32 schemas=DWH This is the start of the output I'v got: Estimate…
user2671057
  • 1,411
  • 2
  • 25
  • 43
1
vote
1 answer

Is this "unknown owner" deadlock a JVM bug, do all java program suffer from it?

One of our web server stopped responsding to any request, jstack suggests that there are deadlocks in the process, serval threads are stuck, the log is like this: Found one Java-level deadlock: ============================= "qtp728030296-143": …
Jin Mengfei
  • 313
  • 3
  • 9
1
vote
1 answer

In this case from Nygard's "Release it!" why do deadlocks happen?

I'm reading over and over this paragraph from Michael Nygard's book "Release it!" and I still don't understand why exactly deadlocks can happen: Imagine 100,000 transactions all trying to update the same row of the same table in the same…
1
vote
1 answer

How to programmatically get stack trace with blocked and waiting info?

I am investigating a dead lock issue (not ANR) in my Android app. When my app detected a potential dead lock, it prints out stack trace of all live threads using Thread.getAllStackTraces(). But this stack trace info doesn't include waiting and…
Kai
  • 3,775
  • 10
  • 39
  • 54
1
vote
1 answer

The reader writer lock I wrote backed by GCD code causes a deadlock in parallel test

I implemented this reader/writer lock in GCD, and it failed in parallel test. Can I get explanation for why it fails? This is for iOS development. The code is based on Objective C. I wrote a RWCache with reader/writer lock in GCD for data…
1
vote
1 answer

Possible deadlock in redshift

I have two redshift queries which seems to block each other, So I am suspecting there's potential deadlock query1 which is a query in a ETL pipeline DROP TABLE IF EXISTS temp_table; CREATE TABLE temp_table AS SELECT * FROM sometable; BEGIN; ALTER…
Harry Su
  • 169
  • 4
  • 11
1
vote
1 answer

Deadlock in PL/pgSQL between same function

I am currently running tpc-c benchmark on PostgreSQL 11.3, and encountered a tricky deadlock problem which has never appeared on Oracle (similar sql). The problem function is create or replace function bmsql_func_payment ( in_w_id integer, …
tabokie
  • 89
  • 5
1
vote
1 answer

Deadlock scenario examples?

Can you give an example of a deadlock scenario between 2 processes (Process A and Process B) where each process needs to access the resources File A, File B, and File C. Present a scenario that allows the 2 processes to become deadlocked? How…
saki18
  • 45
  • 1
  • 5
1
vote
0 answers

Python3.5.x deadlock detected while testing connectivity to the internet

A python3.5 application occasionally deadlocks when run. To give more details about the application, the main thread (thread A) is responsible for receiving data from an external device and sending it to an MQTT broker. There are two other threads…
nbn
  • 11
  • 2
1
vote
1 answer

How to detect if a Scheduled SpringBoot task has been deadlocked?

I have a scheduled task using SpringBoot Scheduled to run Monday through Friday at 10 AM. I'm running my application in a docker container and my machine is suspended from 6pm to 9am overnight. When I start my machine, my tasks that were scheduled…
1
vote
0 answers

SQL Server - Multiple inserts on single table causing deadlocks

Willing to understand a scenario when deadlock is occurring in a table with 1 clustered and 1 non-clustered index due to multiple insert statements. The solution was weird, where ignoreDuplicateKey was set to False, which resolved the problem. It…
1
vote
1 answer

SQL Server 6.5 deadlocks with Spanish letters ú and ü

We're running SQL 6.5 though ADO and we have the oddest problem. This sentence will start generating deadlocks insert clinical_notes ( NOTE_ID, CLIENT, MBR_ID, EPISODE, NOTE_DATE_TIME, NOTE_TEXT, DEI, CARE_MGR, RELATED_EVT_ID, SERIES, EAP_CASE,…
Aaron
  • 85
  • 1
  • 4
1
vote
1 answer

NetBeans IDE deadlock

I've already gone to the NetBeans bug reporting community, before anyone points me there. They have no solution. In every NetBeans IDE I use (I have 4 versions (6.9, 6.9.1, 7.0, and the latest experimental build) on multiple computers), they…
Ky -
  • 30,724
  • 51
  • 192
  • 308