Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brqWg-0000jE-Lv for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Oct 2016 18:02:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1brqWf-0001Zv-Ig for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Oct 2016 18:02:41 +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 1brqVG-0008P7-Qr for pgsql-hackers@postgreSQL.org; Wed, 05 Oct 2016 18:01:14 +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 1brqV9-00045p-52 for pgsql-hackers@postgreSQL.org; Wed, 05 Oct 2016 18:01:13 +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 u95I15Mg014948 for ; Wed, 5 Oct 2016 14:01:05 -0400 From: Tom Lane To: pgsql-hackers@postgreSQL.org Subject: Our "fallback" atomics implementation doesn't actually work Date: Wed, 05 Oct 2016 14:01:05 -0400 Message-ID: <14947.1475690465@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 I was trying to measure whether unnamed POSIX semaphores are any faster or slower than the SysV kind. Plain pgbench is not very helpful for determining this, because we've optimized the system to the point that you don't hit semop waits all that often. So I tried this: configure USE_UNNAMED_POSIX_SEMAPHORES=1 --disable-cassert --disable-spinlocks --disable-atomics figuring that that would stress the semop paths nicely. But what I find is that the database locks up after a few seconds of running "pgbench -S -c 20 -j 20 bench" on an 8-core RHEL6 machine. I think what is happening is that there are circular assumptions that end up trying to implement a spinlock in terms of a spinlock, or otherwise somehow recursively use the process's semaphore. It's a bit hard to tell though because the atomics code is such an underdocumented rat's nest of #ifdefs. Curiously, I did not see such a hang with regular SysV semaphores. That may be just a timing thing, or it may have something to do with POSIX semaphores being actually futexes on this platform (so that there is state inside the process not outside it). No hang observed without --disable-atomics, either. 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