Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WsccV-0001Ih-CB for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Jun 2014 18:42:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WsccT-0001ic-T5 for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Jun 2014 18:42:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WsccS-0001fn-Gj for pgsql-bugs@postgresql.org; Thu, 05 Jun 2014 18:42:32 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WsccO-00023s-K6 for pgsql-bugs@postgresql.org; Thu, 05 Jun 2014 18:42:30 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 872DA2B573; Thu, 5 Jun 2014 11:42:26 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 7F93318568; Thu, 5 Jun 2014 11:42:26 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 84664120030; Thu, 5 Jun 2014 11:42:37 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Thu, 5 Jun 2014 11:42:36 -0700 (PDT) Message-ID: <5390BA0F.2030103@vmware.com> Date: Thu, 05 Jun 2014 21:42:23 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: levertond@googlemail.com, pgsql-bugs@postgresql.org, Alvaro Herrera Subject: Re: BUG #10533: 9.4 beta1 assertion failure in autovacuum process References: <20140605180121.3061.28250@wrigleys.postgresql.org> In-Reply-To: <20140605180121.3061.28250@wrigleys.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 06/05/2014 09:01 PM, levertond@googlemail.com wrote: > The following bug has been logged on the website: > > Bug reference: 10533 > Logged by: David Leverton > Email address: levertond@googlemail.com > PostgreSQL version: 9.4beta1 > Operating system: RHEL 5 x86_64 > Description: > > Our application's test suite triggers an assertion failure in an autovacuum > process under 9.4 beta1. I wasn't able to reduce it to a nice test case, > but I hope the backtrace illustrates the problem: Yes, it does, thanks for the report! > #0 0x00000032bae30265 in raise () from /lib64/libc.so.6 > #1 0x00000032bae31d10 in abort () from /lib64/libc.so.6 > #2 0x000000000078b69d in ExceptionalCondition (conditionName= optimized out>, errorType=, > fileName=, lineNumber=) at > assert.c:54 > #3 0x00000000007ad6e2 in palloc (size=16) at mcxt.c:670 > #4 0x00000000004d3592 in GetMultiXactIdMembers (multi=75092, > members=0x7fff915f9468, allow_old=0 '\000') at multixact.c:1242 > #5 0x0000000000495c9c in MultiXactIdGetUpdateXid (xmax=17061, > t_infomask=) at heapam.c:6059 > #6 0x00000000007ba93c in HeapTupleHeaderIsOnlyLocked (tuple=0x42a5) at > tqual.c:1539 > #7 0x00000000007baf2c in HeapTupleSatisfiesVacuum (htup= out>, OldestXmin=67407, buffer=347) at tqual.c:1174 > #8 0x00000000005a96eb in heap_page_is_all_visible (onerel=0x2b1b020f3f58, > blkno=86, buffer=347, tupindex=339, vacrelstats=0x1cfe3148, > vmbuffer=0x7fff915fa65c) at vacuumlazy.c:1788 > #9 lazy_vacuum_page (onerel=0x2b1b020f3f58, blkno=86, buffer=347, > tupindex=339, vacrelstats=0x1cfe3148, vmbuffer=0x7fff915fa65c) > at vacuumlazy.c:1220 > ... MultiXactIdGetUpdateXid() calls GetMultiXactIdMembers(), which can fail if you run out of memory. That's not cool if you're in a critical section, as the error will be promoted to PANIC; the assertion checks that you don't call palloc() while in a critical section, to catch that kind of problems early. The potential for a problem is there in 9.3 as well, but the assertion was only added to 9.4 fairly recently. That function requires very little memory, so it's highly unlikely to fail with OOM in practice, but in theory it could. I think we'll need a variant of GetMultiXactIdMembers() that only returns the update XID, avoiding the palloc(). The straight-forward fix would be to copy-paste contents of GetMultiXactIdMembers() into MultiXactIdGetUpdateXid(), and instead of returning the members in an array, only return the update-xid. But it's a long and complicated function, so copy-pasting is not a good option. I think it needs to be refactored into some kind of a helper function that both MultiXactIdGetUpdateXid() and GetMultiXactIdMembers() could call. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs