Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible

From: Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org>
To: Palle Girgensohn <girgen(at)FreeBSD(dot)org>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-admin(at)postgresql(dot)org, "pgsql(at)freebsd(dot)org" <pgsql(at)FreeBSD(dot)org>, "gerald(at)freebsd(dot)org" <gerald(at)FreeBSD(dot)org>
Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible
Date: 2019-03-09 14:43:36
Message-ID: 20190309144336.GA17688@gate.oper.dinoex.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Palle!

On Sat, Mar 09, 2019 at 01:42:55PM +0100, Palle Girgensohn wrote:
! > 9 mars 2019 kl. 01:17 skrev Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message wambacher 2019-03-10 10:57:58 Can't stop pgAdmin4 server process
Previous Message Palle Girgensohn 2019-03-09 12:42:55 Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible