Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1appJb-000838-Rt for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 03:48:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1appJa-0007qc-Ag for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 03:48:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1appIE-0006Jc-Hz for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 03:47:10 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1appIB-0003nD-Ct for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 03:47:09 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 067E021995 for ; Mon, 11 Apr 2016 23:47:06 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 11 Apr 2016 23:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=0ys/eS3ZP4cj1Q6Nr3B47TJR5fk=; b=CPK7q 3DCNer+r3X5Ekzqx+MhwINyZAmcpwz82t8qA/5wyUIXqbDaoNDfACd/HtPZ52+Ac gjLNozW33weB1+EfQiHOTmyF7vIWr8xzLJLHLuD2k0pKfT6EJt/AlBQaz6IqW2rl iSlTnMg/v/ZpEzcfFJXVDWh/hlPSLC1ClMBASE= X-Sasl-enc: f5IRs6AZryzaF0NlwshbMVRz3lC8sxYcCEUbypmAwOZx 1460432825 Received: from intern.anarazel.de (unknown [184.23.178.130]) by mail.messagingengine.com (Postfix) with ESMTPA id AEF2BC0001D; Mon, 11 Apr 2016 23:47:05 -0400 (EDT) Date: Mon, 11 Apr 2016 20:47:04 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Re: [COMMITTERS] pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner. Message-ID: <20160412034704.oowjuayv5kfn3guc@alap3.anarazel.de> References: <1881.1460431476@sss.pgh.pa.us> <20160412033618.c56ksvf3me4mpwii@alap3.anarazel.de> <2490.1460432470@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2490.1460432470@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-04-11 23:41:10 -0400, Tom Lane wrote: > Andres Freund writes: > > The issue is likely that either Alexander or I somehow made > > MarkLocalBufferDirty() use pg_atomic_fetch_or_u32(), instead of the > > proper pg_atomic_read_u32()/pg_atomic_write_u32(). > > The stack trace I'm seeing is > > #5 0x7279cc in elog_finish (elevel=6, > fmt=0x40057cf8 '\177' ...) at elog.c:1378 > #6 0x5cecd8 in s_lock_stuck (p=0x402995b8, file=0x21bae0 "s_lock.c", line=92) > at s_lock.c:81 > #7 0x5cedd4 in perform_spin_delay (status=0x7b03b8c8) at s_lock.c:130 > #8 0x5ced40 in s_lock (lock=0x6, file=0x20
, > line=6) at s_lock.c:96 > #9 0x53a4b0 in pg_atomic_compare_exchange_u32_impl (ptr=0x402995b8, > expected=0x5c, newval=58982400) at atomics.c:122 > #10 0x5a280c in MarkLocalBufferDirty (buffer=6) > at ../../../../src/include/port/atomics/generic.h:224 Ok, so the theory above fits. Will fix (both initialization and use of pg_atomic_fetch_or_u32), and expand the documentation on why only atomic read/write are supposed to be used. Thanks, Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers