pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: henk de wit <henk53602@hotmail.com>
To: pgsql-admin@postgresql.org
Subject: Spurious failure to obtain row lock possible in PG 9.1?
Date: Mon, 24 Sep 2012 23:21:10 +0200
Message-ID: <COL104-W253AD06D6F4F89C3EC1F76F59E0@phx.gbl> (raw)


I'm using Postgres 9.1 on Debian Lenny and via a Java server (JBoss AS 6.1) I'm executing a simple "select ... for update" query:
SELECT
	importing
FROM
	customer
WHERE
	id = :customer_id
FOR UPDATE NOWAIT
Once every 10 to 20 times Postgres fails to obtain the lock for no apparent reason:
18:22:18,285 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 55P0318:22:18,285 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: could not obtain lock on row in relation "customer"
I'm "pretty" sure there's really no other process that has the lock, as I'm the only one on a test DB. If I execute the query immediately again, it does succeed in obtaining the lock. I can however not reproduce this via e.g. PGAdmin.

Is it possible or perhaps even known that PG has this behavior, or should I look for the cause in the Java code? (I'm using Java EE"s entity manager to execute a native query inside an EJB bean that lets a JDBC connection from a pool join a JTA transaction.)
Thanks! 		 	   		  =

Message-ID: <COL104-W253AD06D6F4F89C3EC1F76F59E0@phx.gbl>
Permalink:  ../COL104-W253AD06D6F4F89C3EC1F76F59E0@phx.gbl/
Also on:    postgresql.org/message-id/COL104-W253AD06D6F4F89C3EC1F76F59E0@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: henk53602@hotmail.com
  Subject: Re: Spurious failure to obtain row lock possible in PG 9.1?
  In-Reply-To: <COL104-W253AD06D6F4F89C3EC1F76F59E0@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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