JSON::XS 4.0 and up with Perl 5.26 and up causes various issues

Hello fellow Perl-mongers,

I'm running into issues with JSON::XS 4.0 / 4.01 in combination with
perl 5.26 and up. I've added a link to a Google drive download with
all the testcases, but in short:

JSON::XS 4.0 with Perl 5.26 and up

* Bizarre copy of HASH in subroutine exit at
* panic: attempt to copy freed scalar 55dd1fa66068 to 55dd1fa660b0 at
* Bizarre copy of ARRAY in anonymous array ([])

JSON XS 4.01 with Perl 5.26 and up

* Attempt to free unreferenced scalar: SV 0x24dbad0, Perl interpreter:
0x1427260
during global destruction.

With Perl 5.24.1 all tests work fine. JSON:XS 3.04 on Perl 5.26/5.28
do not seem to have issues.

Reproduction path:
https://drive.google.com/open?id=1bD8lKlRn6xq6NPRkzUx-HIw2ReLhCM6n

My question is, what has changed between 5.24 and 5.26 that starts
breaking JSON::XS 4.0/4.01?

Many thanks!
Wesley

--
Wesley Schwengle, Developer
Mintlab B.V., https://www.zaaksysteem.nl
E: wesley@mintlab.nl
T:  +31 20 737 00 05
0
wesley
3/5/2019 9:10:42 AM
perl.perl5.porters 47615 articles. 1 followers. Follow

1 Replies
41 Views

Similar Articles

[PageSpeed] 42

--Sig_/mX=vWoApolrWfLYSqha_xCg
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Tue, 5 Mar 2019 10:10:42 +0100, Wesley Schwengle <wesley@mintlab.nl>
wrote:

> JSON XS 4.01 with Perl 5.26 and up
>=20
> * Attempt to free unreferenced scalar: SV 0x24dbad0, Perl interpreter:
>   0x1427260 during global destruction.

   $ perl json-xs-moo.t
   :
   :
   # Looks like you failed 3 tests of 3.

When the test is run many times, there are three possible outcomes:

1. No warnings and no errors from perl itself

2. Free warning

Attempt to free unreferenced scalar: SV 0x2691ac0, Perl interpreter: 0x15dc=
fe0 during global destruction.

3. Segmentation fault (core dumped) after that message

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7d94822 in S_hv_free_ent_ret.isra.3 ()
   from
/pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so

(gdb) where
#0  0x00007ffff7d94822 in S_hv_free_ent_ret.isra.3 ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#1  0x00007ffff7d94aaf in Perl_hfree_next_entry ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#2  0x00007ffff7daaa66 in Perl_sv_clear ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#3  0x00007ffff7daae62 in Perl_sv_free2 ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#4  0x00007ffff7da8ed8 in S_visit ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#5  0x00007ffff7dab366 in Perl_sv_clean_objs ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#6  0x00007ffff7d13ee6 in perl_destruct ()
   from /pro/lib/perl5/5.28.1/x86_64-linux-thread-multi-ld/CORE/libperl.so
#7  0x0000000000401234 in main ()

This is perl 5, version 28, subversion 1 (v5.28.1) built for x86_64-linux-t=
hread-multi-ld

JSON::XS-4.01
Moo-2.003004

--=20
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

--Sig_/mX=vWoApolrWfLYSqha_xCg
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJcflLGAAoJEAOhR6E+XcCYhiUIAJVVBwH+RbJIErTSWp+hdjcC
F0JiVWq+Q5FC0QIVMNqtDMYi+M7lpZPpGobMdCre9gl+X7300tMDoJuAxm6mWnZz
Y+dNTKVs7xGnPml2A9818WPOCJX+/8vKbkscv/rVIRiOigL6Kf1vnQ6sBLxBLabg
9oAQ18KYo0HlF11tSf24/UGSy+xHBseozkLkUlZTm8lkwOOIRn/i1pSH5vpWme8F
A8n8JwUyolRSLIia8mj4CTVEt1EvkDXzySIYg3gUXfofdHWGNlY91M+ZYYZT51Uq
WiqKGCLGLEyTlPab4I+3Dk32zAM2l2F3NoTon75Gj5k1BkRoh3MLiuOBqMB+g78=
=0u7c
-----END PGP SIGNATURE-----

--Sig_/mX=vWoApolrWfLYSqha_xCg--
0
h
3/5/2019 10:43:10 AM
Reply: