Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brzyZ-0004xh-Ao for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Oct 2016 04:08:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1brzyY-000667-ST for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Oct 2016 04:08:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1brzx9-0004XU-U5 for pgsql-hackers@postgresql.org; Thu, 06 Oct 2016 04:06:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1brzx7-0003Px-4x for pgsql-hackers@postgresql.org; Thu, 06 Oct 2016 04:06:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9646X5p025315; Thu, 6 Oct 2016 00:06:33 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org Subject: Re: Our "fallback" atomics implementation doesn't actually work In-reply-to: <20161006024811.fcll3nnfmdn4qtpy@alap3.anarazel.de> References: <14947.1475690465@sss.pgh.pa.us> <20161005183402.6veikn2ajr52vosy@alap3.anarazel.de> <24585.1475694129@sss.pgh.pa.us> <20161006024811.fcll3nnfmdn4qtpy@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 05 Oct 2016 19:48:11 -0700" Date: Thu, 06 Oct 2016 00:06:33 -0400 Message-ID: <25314.1475726793@sss.pgh.pa.us> X-Pg-Spam-Score: -4.5 (----) 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 Andres Freund writes: > Hm. After a long battle of head vs. wall I think I see what the problem > is. For the fallback atomics implementation I somehow had assumed that > pg_atomic_write_u32() doesn't need to lock, as it's just an unlocked > write. But that's not true, because it has to cause > pg_atomic_compare_exchange_u32 to fail. Hah ... obvious once you see it. > For me the problem often takes a lot longer to reproduce (once only > after 40min), could you run with the attached patch, and see whether > that fixes things for you? For me, with the described test case, HEAD fails within a minute, two times out of three or so. I've not reproduced it after half an hour of beating on this patch. Looks good. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers