From: vaiayand@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #8095: postgres acquiring lock on a table when not in transaction
Date: Fri, 19 Apr 2013 00:54:07 +0000
Message-ID: <E1USzaZ-00011S-JL@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: vaiayand@gmail.com
Subject: Re: BUG #8095: postgres acquiring lock on a table when not in transaction
In-Reply-To: <E1USzaZ-00011S-JL@wrigleys.postgresql.org>
References: <E1USzaZ-00011S-JL@wrigleys.postgresql.org>
* 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