Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2NkJ-0007Ek-IS for pgsql-admin@arkaria.postgresql.org; Fri, 08 Mar 2019 22:13:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2NkG-0001Sb-Nl for pgsql-admin@arkaria.postgresql.org; Fri, 08 Mar 2019 22:13:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2NkG-0001RR-C1 for pgsql-admin@lists.postgresql.org; Fri, 08 Mar 2019 22:13:36 +0000 Received: from uucp.dinoex.sub.de ([2001:1440:5001:1::2]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2NkC-0006XF-5f for pgsql-admin@postgresql.org; Fri, 08 Mar 2019 22:13:34 +0000 Received: from uucp.dinoex.sub.de (uucp.dinoex.sub.de [194.45.71.2]) by uucp.dinoex.sub.de (8.15.2/8.15.2) with ESMTPS id x28MD5cV057939 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 8 Mar 2019 23:13:05 +0100 (CET) (envelope-from pmc@citylink.dinoex.sub.org) Received: from citylink.dinoex.sub.org (uucp@localhost) by uucp.dinoex.sub.de (8.15.2/8.15.2/Submit) with UUCP id x28MD5vj057938; Fri, 8 Mar 2019 23:13:05 +0100 (CET) (envelope-from pmc@citylink.dinoex.sub.org) Received: from gate.oper.dinoex.org (gate-e [192.168.98.2]) by citylink.dinoex.sub.de (8.15.2/8.15.2) with ESMTP id x28LGpSO010220; Fri, 8 Mar 2019 22:16:51 +0100 (CET) (envelope-from peter@gate.oper.dinoex.org) Received: from gate.oper.dinoex.org (gate-e [192.168.98.2]) by gate.oper.dinoex.org (8.15.2/8.15.2) with ESMTP id x28LEbfK010085; Fri, 8 Mar 2019 22:14:38 +0100 (CET) (envelope-from peter@gate.oper.dinoex.org) Received: (from peter@localhost) by gate.oper.dinoex.org (8.15.2/8.15.2/Submit) id x28LEbbV010084; Fri, 8 Mar 2019 22:14:37 +0100 (CET) (envelope-from peter) Date: Fri, 8 Mar 2019 22:14:37 +0100 From: Peter To: Andrew Gierth Cc: pgsql-admin@postgresql.org, pgsql@FreeBSD.org Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible Message-ID: <20190308211437.GA86762@gate.oper.dinoex.org> References: <20190308012012.GA49481@gate.oper.dinoex.org> <87lg1qaxr2.fsf@news-spur.riddles.org.uk> <20190308152238.GA50588@gate.oper.dinoex.org> <87ef7hbal7.fsf@news-spur.riddles.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ef7hbal7.fsf@news-spur.riddles.org.uk> User-Agent: Mutt/1.11.1 (2018-12-01) X-Milter: Spamilter (Reciever: uucp.dinoex.sub.de; Sender-ip: 194.45.71.2; Sender-helo: uucp.dinoex.sub.de;) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (uucp.dinoex.sub.de [194.45.71.2]); Fri, 08 Mar 2019 23:13:09 +0100 (CET) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Andrew, many thanks for Your efforts! Lets see what I get out of this. First, it seems I can reproduce the fault on my build machine (IvyBridge core-i5) in the i386-chroot as well - which is not a surprize according to Your explanations. On Fri, Mar 08, 2019 at 04:51:47PM +0000, Andrew Gierth wrote: ! MOVAPS is an SSE (not SSE2) instruction; it's enabled by virtue of the ! fact that you used -march=pentium3 (the pentium3 supports SSE but not ! SSE2). The "A" stands for "aligned"; an unaligned source address causes ! an exception. %esp+0x20 is not correctly aligned for the instruction. Okay so far. I was occasionally wondering if that pentium3 option would effect anything at all. Now we see, it does. ;) ! GCC defaults to using a 16-byte stack alignment, but it relies on the ! caller to align the stack too, so if a GCC-compiled function is called ! from code that doesn't align the stack, then this kind of error can ! result. I do not know offhand (but I plan to find out) what clang's ! default stack alignment on i386 is. Well, what caused me a headache this evening is: who would be the caller in this case, as -from my understanding- it is just postgreSQL running? Now from Your newer mail this riddle does clear up well. In my build environment, I can now create and start a new db-cluster and issue only the single command "CREATE ROLE bacula;" and it will crash - but then again I have to wait for the next checkpointer. ! You can tell GCC to realign the stack itself using the -mstackrealign ! option. Yepp, that appears to solve it. So, as there is a fix now, I'm pondering about who would be the responsible to apply it? * the system owner (alongside with the CPU definition) * the port maintainer (alongside with the compiler choice) * the postgres configure script ! This problem shows up only with GCC and not with clang because clang ! does not attempt to use SSE to vectorize this particular piece of code. ! The non-vectorized implementation generated by clang has no special ! requirements for stack alignment. But at the end of the day this is not ! a problem with PostgreSQL - it would show up with any code compiled with ! GCC where the compiler had elected to use SSE instructions for ! optimization. Well, its clearly my fault, coming up with that pentium3 option. *gg* rgds, P.