pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8095: postgres acquiring lock on a table when not in transaction
3+ messages / 2 participants
[nested] [flat]

* BUG #8095: postgres acquiring lock on a table when not in transaction
@ 2013-04-19 00:54 vaiayand@gmail.com
  2013-04-19 16:52 ` Re: BUG #8095: postgres acquiring lock on a table when not in transaction Tom Lane <tgl@sss.pgh.pa.us>
  2013-04-20 21:02 ` Re: BUG #8095: postgres acquiring lock on a table when not in transaction Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: vaiayand@gmail.com @ 2013-04-19 00:54 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8095
Logged by:          Nachiket Vaidya
Email address:      vaiayand@gmail.com
PostgreSQL version: 9.2.4
Operating system:   ubuntu
Description:        

Issue:
------
We investigated one issue and found the following:
postgres is acquiring a lock on table when not in trancation during prepared
ROLLBACK statement. It is releasing the acquired lock at end.
but postgres should not get lock on a table when not in transaction. After
acquiring any lock, if backend process dies (say SIGTERM signal), the
postgres will be in lock-not-released state.

Steps to reproduce:
-------------------
1. configure with
export CFLAGS="-DCLOBBER_CACHE_ALWAYS -DRELCACHE_FORCE_RELEASE -g ";
./configure --prefix=..
// forcing to release to system cache.

2. make and make install

3. compile prepare.c (attached)

4. Run server.

5. Run binary of prepare.c and grab pid of backend (it will be printed as
output of binary).

6. Attach gdb for backend gdb -p <pid>.

7. Put the break on exec_parse_message().

8. After break point got reached, put break on LockRelease().

9. After break point got reached for LockRelease(), send signal 15 (SIGTERM)
through gdb (signal 15).

// In steps 7-9, we make sure that we send signal SIGTERM to process after
lock acquire before lock release.

10. continue till process exits.

11. now run binary of prepare.c without attaching gdb (start psql client).
You will get the error at server:
-----------------------
LOG:  server process (PID 18314) was terminated by signal 11: Segmentation
fault
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the
current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2013-04-18 16:16:40
PDT
LOG:  database system was not properly shut down; automatic recovery in
progress
LOG:  record with zero length at 0/176B9B0
LOG:  redo is not required
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

on 8.4.17, I am getting an error:
--------------------------------
psql: FATAL:  lock AccessShareLock on object 11564/1259/0 is already held.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #8095: postgres acquiring lock on a table when not in transaction
  2013-04-19 00:54 BUG #8095: postgres acquiring lock on a table when not in transaction vaiayand@gmail.com
@ 2013-04-19 16:52 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2013-04-19 16:52 UTC (permalink / raw)
  To: vaiayand@gmail.com; +Cc: pgsql-bugs

vaiayand@gmail.com writes:
> 3. compile prepare.c (attached)

I see no such attachment ...

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #8095: postgres acquiring lock on a table when not in transaction
  2013-04-19 00:54 BUG #8095: postgres acquiring lock on a table when not in transaction vaiayand@gmail.com
@ 2013-04-20 21:02 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2013-04-20 21:02 UTC (permalink / raw)
  To: vaidyand@gmail.com; +Cc: pgsql-bugs

vaiayand@gmail.com writes:
> We investigated one issue and found the following:
> postgres is acquiring a lock on table when not in trancation during prepared
> ROLLBACK statement. It is releasing the acquired lock at end.
> but postgres should not get lock on a table when not in transaction. After
> acquiring any lock, if backend process dies (say SIGTERM signal), the
> postgres will be in lock-not-released state.

Thanks for the report.  I believe I've fixed this.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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


end of thread, other threads:[~2013-04-20 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-04-19 00:54 BUG #8095: postgres acquiring lock on a table when not in transaction vaiayand@gmail.com
2013-04-19 16:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-20 21:02 ` Tom Lane <tgl@sss.pgh.pa.us>

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