Issue with v11.0 within jsonb_plperl tests in 32bit on AIX

From: "REIX, Tony" <tony(dot)reix(at)atos(dot)net>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: "REIX, Tony" <tony(dot)reix(at)atos(dot)net>
Subject: Issue with v11.0 within jsonb_plperl tests in 32bit on AIX
Date: 2018-11-06 16:26:26
Message-ID: HE1PR0202MB2812DF381700D3865F13546286CB0@HE1PR0202MB2812.eurprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I'm building PostgreSQL v11.0 on AIX (6.1, 7.1, & 7.2).

The 2 new tests jsonb_plperl fail in 32bit, not in 64bit.

All other tests are OK.

- Same issue for all 3 versions of AIX

- Version of Perl : 5.24.0

- Version of Python: 2.7.12

I have traced details, but it is still unclear to me what is the root cause.

I'd like to have some help.

Does someone has already built and tested PostgreSQL v11.0 in 32bit on Linux/x86_64 ?

Looking at details, it seems that some control of the conversion of infinity to json is not done in 32bit.

Do you think that this issue comes from inside PostgreSQL code of from the AIX tools used by PostgreSQL ?

Thanks

Tony

1) Traces of the execution of the tests:

for extra in contrib/jsonb_plperl; do gmake -C '../..'/$extra DESTDIR='/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit'/tmp_install install >>'/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit'/tmp_install/log/install.log || exit; done
PATH="/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit/tmp_install/opt/freeware/bin:$PATH" LIBPATH="/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit/tmp_install/opt/freeware/lib:$LIBPATH" ../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=. --bindir= --dbname=contrib_regression jsonb_plperl jsonb_plperlu
============== creating temporary instance ==============
============== initializing database system ==============
============== starting postmaster ==============
running on port 60848 with PID 22610390
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test jsonb_plperl ... FAILED
test jsonb_plperlu ... FAILED
============== shutting down postmaster ==============

======================
2 of 2 tests failed.
======================

2) Details of the trace

64bit : OK

32bit : 2 failures :
============== running regression test queries ==============
test jsonb_plperl ... FAILED
test jsonb_plperlu ... FAILED

# diff ./contrib/jsonb_plperl/expected/jsonb_plperl.out ./contrib/jsonb_plperl/results/jsonb_plperl.out
68,70c68,70
< roundtrip
< -----------
< 1
---
> roundtrip
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000266336279953129
74,75c74,78
< ERROR: cannot convert infinity to jsonb
< CONTEXT: PL/Perl function "roundtrip"
---
> roundtrip
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000266336287858179
> (1 row)
>
etc........

cd contrib/jsonb_plperl/

sql/jsonb_plperl.sql :

...
CREATE FUNCTION roundtrip(val jsonb, ref text = ) RETURNS jsonb
LANGUAGE plperl
TRANSFORM FOR TYPE jsonb
AS $$
# can't use Data::Dumper, but let's at least check for unexpected ref type
die 'unexpected '.(ref($_[0]) || 'not a').' reference'
if ref($_[0]) ne $_[1];
return $_[0];
$$;

SELECT roundtrip('null') is null;
SELECT roundtrip('1');
SELECT roundtrip('1E+131071');
SELECT roundtrip('-1');
SELECT roundtrip('1.2');
SELECT roundtrip('-1.2');
SELECT roundtrip('"string"');
SELECT roundtrip('"NaN"');
...

How to reproduce :

su pgstbf -c "(set -x; ulimit -a; cd /opt/freeware/src/packages/BUILD/postgresql-11.0/32bit/contrib/jsonb_plperl || exit 1; \
ulimit -f unlimited; \
PATH="/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit/tmp_install/opt/freeware/bin:$PATH" \
LIBPATH="/opt/freeware/src/packages/BUILD/postgresql-11.0/32bit/tmp_install/opt/freeware/lib:$LIBPATH" \
../../src/test/regress/pg_regress --debug \
--temp-instance=./tmp_check \
--inputdir=. \
--bindir= \
--dbname=contrib_regression \
jsonb_plperl \
jsonb_plperlu )"

../../src/test/regress/pg_regress : executable
If one uses the 64bit version of pg_regress : Same issue. Thus, not an issue due to pg_regress.

--debug option generates traces in files :
log/initdb.log
log/postmaster.log

a) Comparaison of files: initdb.log 64bit vs 32 bit :
# export D=`date +"%Y-%m-%d"`
# cat log/initdb.log | awk -v D=$D '{if($1==D){print $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15}else{print $0}}' > /tmp/initdb.log.32
Idem en 64bit

# diff /tmp/initdb.log.64 /tmp/initdb.log.32
...
23c23
< creating directory /home2/freeware/src/packages/BUILD/postgresql-11.0/64bit/contrib/jsonb_plperl/./tmp_check/data ... ok
---
> creating directory /home2/freeware/src/packages/BUILD/postgresql-11.0/32bit/contrib/jsonb_plperl/./tmp_check/data ... ok
29c29
< running bootstrap script ... 2018-11-06 16:01:19.632 CST [21823838] DEBUG: invoking IpcMemoryCreate(size=148676608)
---
> running bootstrap script ... 2018-11-06 15:51:43.604 CST [26804718] DEBUG: invoking IpcMemoryCreate(size=146415616)
33c33
< DEBUG: created dynamic shared memory control segment 944926165 (6928 bytes)
---
> DEBUG: created dynamic shared memory control segment 203612733 (4620 bytes)
41c41
< NOTICE: database system was shut down at 2018-11-06 16:01:19 CST
---
> NOTICE: database system was shut down at 2018-11-06 15:51:43 CST

146201,146202c146201,146202
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

147519,147520c147519,147520
< DEBUG: inserting column 3 value "8"
< DEBUG: inserted -> 8
---
> DEBUG: inserting column 3 value "4"
> DEBUG: inserted -> 4

147553,147554c147553,147554
< DEBUG: inserting column 20 value "d"
< DEBUG: inserted -> d
---
> DEBUG: inserting column 20 value "i"
> DEBUG: inserted -> i

148121,148122c148121,148122
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

148541,148542c148541,148542
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

151121,151122c151121,151122
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f
151181,151182c151181,151182

< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

151421,151422c151421,151422
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

153222,153223c153222,153223
< DEBUG: inserting column 4 value "true"
< DEBUG: inserted -> t
---
> DEBUG: inserting column 4 value "false"
> DEBUG: inserted -> f

155440,155441c155440,155441
< DEBUG: inserting column 3 value "8"
< DEBUG: inserted -> 8
---
> DEBUG: inserting column 3 value "4"
> DEBUG: inserted -> 4

155474,155475c155474,155475
< DEBUG: inserting column 20 value "d"
< DEBUG: inserted -> d
---
> DEBUG: inserting column 20 value "i"
> DEBUG: inserted -> i

...

b) Comparaison of files: postmaster.log 64bit vs 32 bit :

# cat log/postmaster.log | awk -v D=$D '{if($1==D){print $6, $7, $8, $9, $10, $11, $12, $13, $14, $15}else{print $0}}' > /tmp/postmaster.log.32

# diff /tmp/postmaster.log.64 /tmp/postmaster.log.32

246a248,249
> reaping dead processes
> server process (PID 18940280) exited with exit code 0
248c251
< DEBUG: postgres child[24969698]: starting with (
---
> DEBUG: postgres child[18940282]: starting with (
253d255
< forked new backend, pid=24969698 socket=8
256,257c258
< reaping dead processes
< server process (PID 14549256) exited with exit code 0
---
> forked new backend, pid=18940282 socket=8
745c746
< LOG: disconnection: session time: 0:00:00.142 user=pgstbf database=contrib_regression host=[local]
---
> LOG: disconnection: session time: 0:00:00.010 user=pgstbf database=contrib_regression host=[local]
751,752c752
< server process (PID 24969698) exited with exit code 0
< forked new backend, pid=24969700 socket=8
---
> server process (PID 18940282) exited with exit code 0
...
3819,3821c3820
< ERROR: cannot convert infinity to jsonb
< CONTEXT: PL/Perl function "roundtrip"
< STATEMENT: SELECT roundtrip('1E+131071');
---
> DEBUG: CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0
...
12572a12570,12571
> reaping dead processes
> server process (PID 18940284) exited with exit code 0
14324c14323
< INFO: $VAR1 = '1' ;
---
> INFO: $VAR1 = '4.94065645841247e-324' ;
14573c14572
< INFO: $VAR1 = '0';
---
> INFO: $VAR1 = '4.94065645841247e-324';

64bit:
...
STATEMENT: SELECT roundtrip('true');
INFO: $VAR1 = '1';
CONTEXT: PL/Perl function "roundtrip"
DEBUG: CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0
DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS, xid/subid/cid: 0/1/0
LOG: statement: SELECT roundtrip('false');
LOG: parse tree:

32bit:
...
STATEMENT: SELECT roundtrip('true');
INFO: $VAR1 = '4.94065645841247e-324' ;
CONTEXT: PL/Perl function "roundtrip"
DEBUG: CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0
DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS, xid/subid/cid: 0/1/0
LOG: statement: SELECT roundtrip('false');
LOG: parse tree:

Cordialement,

Tony Reix

tony(dot)reix(at)atos(dot)net

ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-11-06 16:31:38 Re: Disallow setting client_min_messages > ERROR?
Previous Message Tom Lane 2018-11-06 16:19:40 Disallow setting client_min_messages > ERROR?