Re: Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)

From: "Tom Turelinckx" <tom(at)turelinckx(dot)be>
To: "'Alvaro Herrera'" <alvherre(at)2ndquadrant(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)
Date: 2017-06-22 13:49:27
Message-ID: 000001d2eb5e$5e3f36e0$1abda4a0$@turelinckx.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera wrote:

> You're probably misreading the git log, because this code was touched
> just before 9.4.9. See commit
> https://git.postgresql.org/pg/commitdiff/20f870fd7cab8446c208a4a9cfa5ec2a441ef69c

Thanks for the pointer! When I reverse patch that commit against 9.4.12 it builds successfully and passes all tests.

Against the original 9.4.12, only the numeric and sanity check tests fail. Depending on the run, various other tests appear to fail, but those failures are caused by the numeric test crashing the backend and the tests being run in parallel:

WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.

I've verified that 10~beta1 also fails the numeric test:

Reading symbols from /home/turelto/src/original/postgresql-10-10~beta1/build/src/backend/postgres...done.
[New LWP 20199]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/sparc-linux-gnu/libthread_db.so.1".
Core was generated by `postgres: turelto regression [local] SELECT '.
Program terminated with signal 10, Bus error.
#0 NUM_numpart_to_char (id=3, Np=0xffd22aa4)
at /home/turelto/src/original/postgresql-10-10~beta1/build/../src/backend/utils/adt/formatting.c:4471
4471 if (Np->Num->lsign == NUM_LSIGN_PRE)
(gdb) l
4466 (Np->num_curr >= Np->out_pre_spaces || (IS_ZERO(Np->Num) && Np->Num->zero_start == Np->num_curr)) &&
4467 (IS_PREDEC_SPACE(Np) == FALSE || (Np->last_relevant && *Np->last_relevant == '.')))
4468 {
4469 if (IS_LSIGN(Np->Num))
4470 {
4471 if (Np->Num->lsign == NUM_LSIGN_PRE)
4472 {
4473 if (Np->sign == '-')
4474 strcpy(Np->inout_p, Np->L_negative_sign);
4475 else

When I reverse patch the above commit against 10~beta1 it also builds successfully and passes all tests.

When I reverse patch the above commit against 9.6.3 it passes the numeric test, but (still) fails the object_address test:

******** build/src/test/regress/regression.diffs ********
*** /home/turelto/src/tmp/postgresql-9.6-9.6.3/build/../src/test/regress/expected/object_address.out 2017-05-08 23:15:12.000000000 +0200
--- /home/turelto/src/tmp/postgresql-9.6-9.6.3/build/src/test/regress/results/object_address.out 2017-06-22 11:11:23.000000000 +0200
***************
*** 263,273 ****
WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" on server "integer" does not exist
WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type i
WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1
--- 263,273 ----
WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{eins},{integer}: user mapping for user "(null)" on server "integer" does not exist
WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "(null)" on server "integer" does not exist
WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1
! WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "(null)" on server "integer" does not exist
WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type i
WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1

======================================================================

The failing user mapping-related tests were introduced in commit 890192e (which is not in 9.4), and may have been resolved by commit 8b6d6cf (which is in 10~beta1).

Best regards,
Tom Turelinckx

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Turelinckx 2017-06-22 13:49:31 Re: Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)
Previous Message Heikki Linnakangas 2017-06-22 11:49:39 Re: Fixed PL/Python hint about array of composites