From: Peter <pmc@citylink.dinoex.sub.org>
To: Palle Girgensohn <girgen@FreeBSD.org>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: pgsql-admin@postgresql.org, "pgsql@freebsd.org" <pgsql@FreeBSD.org>
Cc: gerald@freebsd.org <gerald@FreeBSD.org>
Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible
Date: Sat, 9 Mar 2019 15:43:36 +0100
Message-ID: <20190309144336.GA17688@gate.oper.dinoex.org> (raw)
In-Reply-To: <4BD693C6-B287-4153-A296-D65BB9874CB2@FreeBSD.org>
References: <20190308012012.GA49481@gate.oper.dinoex.org>
<87y35p9l0k.fsf@news-spur.riddles.org.uk>
<20190309001707.GA14810@gate.oper.dinoex.org>
<4BD693C6-B287-4153-A296-D65BB9874CB2@FreeBSD.org>
Hi Palle!
On Sat, Mar 09, 2019 at 01:42:55PM +0100, Palle Girgensohn wrote:
! > 9 mars 2019 kl. 01:17 skrev Peter <pmc@citylink.dinoex.sub.org>:
! > Yes, -mstackrealign helps. So, as my local problem is now solved,
! > I am thinking about that "greater good for mankind" thing. ;)
! >
! > At least one other person did run into the issue, and from Your
! > explanation I understand that this is not a postgres issue, but
! > could happen to any piece of software that decides to use gcc.
! >
! > Now it seems easy to put this compiler option into the port's
! > specific makefile for postgreSQL, but it should actually be fixed
! > systemwide.
! >
! > But, while it gets recommended to set the cpu-type systemwide on
! > FreeBSD, it is not recommend for the system owner to set CFLAGS
! > systemwide (even less specific ones for gcc - and I didn't find
! > a proper way to do that, anyway).
! >
! > So my proposal is that this one belongs into /usr/ports/Mk/bsd.gcc.mk
! >
! > + .if ${MACHINE_CPU:Msse} && ${MACHINE_ARCH} == i386
! > + CFLAGS+= -mstackrealign
! > + .endif
! >
! > That seems to work. Palle, Your opinion?
!
! Well, we ideally want the binary packages built with the ports
! framework, for a specific platform, in this case i386, to work on all
! i386 machines. This makes it a bit more complicated.
Yes, that was my intention! The MACHINE_CPU variable gets already
populated with "sse" (from somewhere in /usr/share/mk).
What I usually do, I do only set the proper CPU type in
/etc/make.conf, and then the "-march=pentium3" (or whatever CPU there is)
appears magically in all builds. I didn't configure this!
/etc/make.conf:
! # Maschine ist Pentium-3
! CPUTYPE?= p3
Nothing more is needed, and now in any ports' directory, we get
! >postgresql10-server$ make -V MACHINE_CPU
! sse i686 mmx i586 i486
Contrarily, if I remove the CPUTYPE from /etc/make.conf, then it says:
! >postgresql10-server$ make -V MACHINE_CPU
! i486
And I suppose these strings appear to be tested for such cases.
! We would have to
! check if the user has any of -msse, -msse2, -march=pentium3 or later,
! or any similar flag that enables use of SSE or later,
If the user explicitely drop in those options, then it gets indeed
complicated. I don't do that - I do NOT set any -march or whatever
options, I only set CPUTYPE in make.conf, as it gets recommended
by developers, e.g. here:
https://forums.freebsd.org/threads/whats-in-your-make-conf.36150/post-199595
And that's why I am thinking of a global fix - because this fault is
happening on recommended practices ground!
! and if the
! underlying userland is built with clang
Ouch, that one I did neglect. One could have built the whole system
with gcc, and then no action is needed. Hmm...
! Perhaps, as Andrew suggests, just adding -mstackrealign defensively
! in the port for i386 is a reasonable tradeoff? It would not help for
! other ports though.
That is reasonable, certainly. :)
PMc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: pmc@citylink.dinoex.sub.org, girgen@FreeBSD.org, andrew@tao11.riddles.org.uk, pgsql@FreeBSD.org, gerald@FreeBSD.org
Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible
In-Reply-To: <20190309144336.GA17688@gate.oper.dinoex.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox