Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Cpanel::JSON::XS crash under Perl 5.26.0

by Athanasius (Archbishop)
on Aug 19, 2017 at 06:52 UTC ( [id://1197643]=perlquestion: print w/replies, xml ) Need Help??

Athanasius has asked for the wisdom of the Perl Monks concerning the following question:

I’m trying to install MongoDB for Strawberry Perl 5.26.0:

This is perl 5, version 26, subversion 0 (v5.26.0) built for MSWin32-x +64-multi-thread-ld

under Windows 8.1 64-bit. One of MongoDB’s dependencies is BSON. which not only fails to install but actually crashes the Perl interpreter while doing so.

After some debugging I eventually reduced the problem code to the following SSCCE:

use strict; use warnings; use JSON::MaybeXS; my $json_codec = JSON::MaybeXS->new; print ref $json_codec, "\n"; print $json_codec->encode( { d => 1.0 } ), "\n";

Note that I have the following modules installed:

16:27 >mversion -f JSON::MaybeXS Cpanel::JSON::XS JSON::XS JSON::PP JSON::MaybeXS 1.003009 Cpanel::JSON::XS 3.0233 JSON::XS 3.04 JSON::PP 2.94 16:27 >

Now to the point: when I run the SSCCE, I get the following output:

19:26 >perl 1800_SoPW.pl Cpanel::JSON::XS

and the Perl interpreter crashes. But if I change the JSON module:

19:26 >perl -MJSON::XS 1800_SoPW.pl JSON::XS {"d":1} 19:27 >

the code completes successfully. I have also tested the SSCCE on Strawberry Perl 5.24.1, and it runs without a problem:

16:37 >perl 1800_SoPW.pl Cpanel::JSON::XS {"d":1.0} 16:38 >

So, I have two sets of questions:

(1) Can other monks confirm this behaviour under Perl 5.26.0? If so, is it confined to Windows or does it occur on other platforms as well? And does anyone know of a change from 5.24 to 5.26 which could account for this? Should I report it as a bug under Cpanel::JSON::XS?

(2) Until the bug is fixed, what’s the best way to prevent JSON::MaybeXS from defaulting to Cpanel::JSON::XS? I can add -MJSON::XS to the command line when invoking a Perl script directly, but how can I get cpanm to do this? Or will I need to uninstall Cpanel::JSON::XS from my system?

Thanks,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re: Cpanel::JSON::XS crash under Perl 5.26.0
by kevbot (Vicar) on Aug 19, 2017 at 07:30 UTC
    Hi Athanasius,

    Your code works fine for me using perl-5.22.2 or perl-5.26.0 on macOS Sierra. Both perls were installed with perlbrew using -Dusethreads.

Re: Cpanel::JSON::XS crash under Perl 5.26.0
by Anonymous Monk on Aug 19, 2017 at 08:07 UTC

      Thanks for the reminder, I forgot that I did try to upgrade to the latest version (viz., 3.027), but the installation also crashed.

      The bug report you cite claims that the crash was fixed in version 3.0219. So is the problem I’m seeing a new bug, or a reappearance of the old one?

      Cheers,

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

        Too early to swy what it is. What is the message in admin tools log?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1197643]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found