How to debug deadlock detected in logs files?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amarqa
    New Member
    • Jan 2011
    • 1

    How to debug deadlock detected in logs files?

    I have a deadlock detected in my postgres log file. My application is getting into such situation in every 4-5 days. Below is the log message:
    Code:
    Process 21865 waits for ShareLock on transaction 9981406; blocked by process 24027.
    Process 24027 waits for ExclusiveLock on tuple (1316,26) of relation 16631 of database 16393; blocked by process 21865.
    Process 21865: update fs_item set version=$1, createdby=$2, lastupdateddate=$3, updatedby=$4, receiptdate=$5, receivedby=$6, credit_amount=$7, credit_currency=$8, credit_systemamount=$9, credit_systemcurrency=$10, credit_exchangerate=$11, ercreceiptdate=$12, ercreceivedby=$13 where itemid=$14 and version=$15
    Process 24027: update fs_item set version=$1, createdby=$2, lastupdateddate=$3, updatedby=$4, receiptdate=$5, receivedby=$6, credit_amount=$7, credit_currency=$8, credit_systemamount=$9, credit_systemcurrency=$10, credit_exchangerate=$11, ercreceiptdate=$12, ercreceivedby=$13 where itemid=$14 and version=$15
    Is there any why by which i can debug this issue?

    Please let me know if there is any clue to the same. We are using Hibernate + ehcahe + Postgres in our application.

    Thanks & Regards,
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    It looks that two processes 21865 and 24027 execute the same update statement without commiting it. Probably there is some unique key or primary key on that table.
    Maybe you have to commit every DML query after executing it.

    Comment

    Working...