Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2F3BD1337BB9 for ; Fri, 4 Mar 2011 04:34:23 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 50677-05 for ; Fri, 4 Mar 2011 08:34:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 4EE471337B6E for ; Fri, 4 Mar 2011 04:34:22 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p248YKjP032581 for ; Fri, 4 Mar 2011 08:34:20 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p248YKlH032580; Fri, 4 Mar 2011 08:34:20 GMT (envelope-from www) Date: Fri, 4 Mar 2011 08:34:20 GMT Message-Id: <201103040834.p248YKlH032580@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5914: locking error in heap_fetch From: "YAMAMOTO Takashi" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201103/95 X-Sequence-Number: 29605 The following bug has been logged online: Bug reference: 5914 Logged by: YAMAMOTO Takashi Email address: yamt@mwd.biglobe.ne.jp PostgreSQL version: 9.1devel Operating system: NetBSD Description: locking error in heap_fetch Details: heap_fetch calls CheckForSerializableConflictOut without buffer locked. it ends up an assertion failure in SetBufferCommitInfoNeedsSave. diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 7dcc601..89697f6 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -1472,10 +1472,10 @@ heap_fetch(Relation relation, if (valid) PredicateLockTuple(relation, tuple); - LockBuffer(buffer, BUFFER_LOCK_UNLOCK); - CheckForSerializableConflictOut(valid, relation, tuple, buffer); + LockBuffer(buffer, BUFFER_LOCK_UNLOCK); + if (valid) { /* (gdb) bt #0 0xbbba4cc7 in _lwp_kill () from /usr/lib/libc.so.12 #1 0xbbba4c85 in raise (s=6) at /siro/nbsd/src/lib/libc/gen/raise.c:48 #2 0xbbba445a in abort () at /siro/nbsd/src/lib/libc/stdlib/abort.c:74 #3 0x083dae20 in ExceptionalCondition ( conditionName=0x8546fa4 "!(LWLockHeldByMe(bufHdr->content_lock))", errorType=0x8546d04 "FailedAssertion", fileName=0x8546cfb "bufmgr.c", lineNumber=2279) at assert.c:57 #4 0x082cb599 in SetBufferCommitInfoNeedsSave (buffer=633) at bufmgr.c:2279 #5 0x0840b8e0 in SetHintBits (tuple=0x9b72efd0, buffer=633, infomask=256, xid=154311) at tqual.c:121 #6 0x0840d614 in HeapTupleSatisfiesVacuum (tuple=0x9b72efd0, OldestXmin=154312, buffer=633) at tqual.c:1128 #7 0x082ea867 in CheckForSerializableConflictOut (visible=1 '\001', relation=0x99b5fcf8, tuple=0xbfbfdee4, buffer=633) at predicate.c:3402 #8 0x080a8c67 in heap_fetch (relation=0x99b5fcf8, snapshot=0x85949a0, tuple=0xbfbfdee4, userbuf=0xbfbfdecc, keep_buf=0 '\0', stats_relation=0x0) at heapam.c:1477 #9 0x081d0174 in AfterTriggerExecute (event=0x99a19044, rel=0x99b5fcf8, trigdesc=0x99a05110, finfo=0x99a05450, instr=0x99a05588, per_tuple_context=0x99b32a50) at trigger.c:3311 #10 0x081d05f2 in afterTriggerInvokeEvents (events=0x99a01120, firing_id=1, estate=0x99a0501c, delete_ok=1 '\001') at trigger.c:3531 #11 0x081d09df in AfterTriggerEndQuery (estate=0x99a0501c) at trigger.c:3721 #12 0x081e8afa in standard_ExecutorFinish (queryDesc=0x99b358bc) at execMain.c:383 #13 0x081e89db in ExecutorFinish (queryDesc=0x99b358bc) at execMain.c:351 #14 0x082f73c2 in ProcessQuery (plan=0x99ba8c4c, sourceText=0x99b3581c "DELETE FROM file WHERE fileid = $1", params=0x99b3587c, dest=0x858ef9c, completionTag=0xbfbfe1f0 "DELETE 1") at pquery.c:227 #15 0x082f8837 in PortalRunMulti (portal=0x99b3d01c, isTopLevel=1 '\001', dest=0x858ef9c, altdest=0x858ef9c, completionTag=0xbfbfe1f0 "DELETE 1") at pquery.c:1276 #16 0x082f7ffe in PortalRun (portal=0x99b3d01c, count=2147483647, isTopLevel=1 '\001', dest=0x99b05428, altdest=0x99b05428, completionTag=0xbfbfe1f0 "DELETE 1") at pquery.c:813 #17 0x082f3df1 in exec_execute_message (portal_name=0x99b0501c "", max_rows=2147483647) at postgres.c:1963 #18 0x082f6709 in PostgresMain (argc=2, argv=0xbb9126a4, username=0xbb9125f8 "takashi") at postgres.c:3959 #19 0x082a81cb in BackendRun (port=0xbb94c0f0) at postmaster.c:3590 #20 0x082a788f in BackendStartup (port=0xbb94c0f0) at postmaster.c:3275 #21 0x082a4b0f in ServerLoop () at postmaster.c:1449 #22 0x082a42be in PostmasterMain (argc=3, argv=0xbfbfe5a8) at postmaster.c:1110 #23 0x08225618 in main (argc=3, argv=0xbfbfe5a8) at main.c:199 (gdb)