pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Query failed: ERROR:  deadlock detected
3+ messages / 2 participants
[nested] [flat]

* Query failed: ERROR:  deadlock detected
@ 2005-08-29 15:50 Aldor <an@mediaroot.de>
  2005-08-29 17:25 ` Re: Query failed: ERROR:  deadlock detected Oliver Elphick <olly@lfix.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Aldor @ 2005-08-29 15:50 UTC (permalink / raw)
  To: pgsql-admin

PostgreSQL 8.0.3: Any idea what this is?

---
Warning: pg_query(): Query failed: ERROR:  deadlock detected
DETAIL:  Process 8835 waits for ShareLock on transaction 193588236;
blocked by process 8834.
Process 8834 waits for ShareLock on transaction 193588228; blocked by
process 8835
---

I have never seen such a log entry until now.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Query failed: ERROR:  deadlock detected
  2005-08-29 15:50 Query failed: ERROR:  deadlock detected Aldor <an@mediaroot.de>
@ 2005-08-29 17:25 ` Oliver Elphick <olly@lfix.co.uk>
  2005-08-29 17:34   ` Re: Query failed: ERROR:  deadlock detected Aldor <an@mediaroot.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Oliver Elphick @ 2005-08-29 17:25 UTC (permalink / raw)
  To: Aldor <an@mediaroot.de>; +Cc: pgsql-admin

On Mon, 2005-08-29 at 16:50 +0100, Aldor wrote:
> PostgreSQL 8.0.3: Any idea what this is?
> 
> ---
> Warning: pg_query(): Query failed: ERROR:  deadlock detected
> DETAIL:  Process 8835 waits for ShareLock on transaction 193588236;
> blocked by process 8834.
> Process 8834 waits for ShareLock on transaction 193588228; blocked by
> process 8835
> ---
> 
> I have never seen such a log entry until now.

You have two transactions locking each other out.

  For example:
    trans A:  begin;
    trans B:  begin;
    trans A:  select * from table_a for update;    -- locks table_a
    trans B:  select * from table_b for update;    -- locks table_b
    trans A:  select * from table_b for update;    -- blocked by trans B's lock
    trans B:  select * from table_a for update;    -- blocked by trans A's lock

Since the two transactions are blocking each other, the locks will never
be released by the transactions that are holding them.  After a preset
interval (about 1 second by default) a deadlock is detected and reported
with this error message and one of the transactions is aborted.

See manual section 12.3.3 in the 8.0 documentation.

-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Query failed: ERROR:  deadlock detected
  2005-08-29 15:50 Query failed: ERROR:  deadlock detected Aldor <an@mediaroot.de>
  2005-08-29 17:25 ` Re: Query failed: ERROR:  deadlock detected Oliver Elphick <olly@lfix.co.uk>
@ 2005-08-29 17:34   ` Aldor <an@mediaroot.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Aldor @ 2005-08-29 17:34 UTC (permalink / raw)
  To: olly@lfix.co.uk; +Cc: pgsql-admin

thanks for the explanation... i found the mistake in a new pl/pgsql
function i wrote before this error occured;-)

Oliver Elphick wrote:
> On Mon, 2005-08-29 at 16:50 +0100, Aldor wrote:
> 
>>PostgreSQL 8.0.3: Any idea what this is?
>>
>>---
>>Warning: pg_query(): Query failed: ERROR:  deadlock detected
>>DETAIL:  Process 8835 waits for ShareLock on transaction 193588236;
>>blocked by process 8834.
>>Process 8834 waits for ShareLock on transaction 193588228; blocked by
>>process 8835
>>---
>>
>>I have never seen such a log entry until now.
> 
> 
> You have two transactions locking each other out.
> 
>   For example:
>     trans A:  begin;
>     trans B:  begin;
>     trans A:  select * from table_a for update;    -- locks table_a
>     trans B:  select * from table_b for update;    -- locks table_b
>     trans A:  select * from table_b for update;    -- blocked by trans B's lock
>     trans B:  select * from table_a for update;    -- blocked by trans A's lock
> 
> Since the two transactions are blocking each other, the locks will never
> be released by the transactions that are holding them.  After a preset
> interval (about 1 second by default) a deadlock is detected and reported
> with this error message and one of the transactions is aborted.
> 
> See manual section 12.3.3 in the 8.0 documentation.
> 



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-08-29 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-29 15:50 Query failed: ERROR:  deadlock detected Aldor <an@mediaroot.de>
2005-08-29 17:25 ` Oliver Elphick <olly@lfix.co.uk>
2005-08-29 17:34   ` Aldor <an@mediaroot.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox