in reply to [SOLVED] JSON::XS parsing error when incrementally parsing JSON file - "panic: sv_chop"
G'day ateague,
I tried running your code but found I didn't have JSON::XS installed under v5.24. On attempting to install using cpan, I got a message which in essence said:
"... standard perl versions 5.022 and up are not supported by JSON::XS."
The full message, in the spoiler below, was far more detailed.
... ---- Unsatisfied dependencies detected during ---- ---- MLEHMANN/JSON-XS-3.02.tar.gz ---- Canary::Stability [build_requires] Running install for module 'Canary::Stability' Fetching with LWP: http://mirror.as24220.net/pub/cpan/authors/id/M/ML/MLEHMANN/Canary-Sta +bility-2012.tar.gz Checksum for /Users/ken/.cpan/sources/authors/id/M/ML/MLEHMANN/Canary- +Stability-2012.tar.gz ok Configuring M/ML/MLEHMANN/Canary-Stability-2012.tar.gz with Makefile.P +L Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Canary::Stability Writing MYMETA.yml and MYMETA.json (/Users/ken/perl5/perlbrew/perls/perl-5.24.0t/bin/perl Makefile.PL exi +ted with 0) CPAN::Reporter: Makefile.PL result is 'pass', No errors. MLEHMANN/Canary-Stability-2012.tar.gz /Users/ken/perl5/perlbrew/perls/perl-5.24.0t/bin/perl Makefile.PL -- + OK Running make for M/ML/MLEHMANN/Canary-Stability-2012.tar.gz cp Stability.pm blib/lib/Canary/Stability.pm Manifying 1 pod document (/usr/bin/make exited with 0) CPAN::Reporter: make result is 'pass', No errors. MLEHMANN/Canary-Stability-2012.tar.gz /usr/bin/make -- OK Running make test No tests defined for Canary::Stability extension. (/usr/bin/make test exited with 0) CPAN::Reporter: Test result is 'unknown', No tests provided. CPAN::Reporter: preparing a CPAN Testers report for Canary-Stability-2 +012 Do you want to review or edit the test report? (yes/no) [no] Do you want to send the report? (yes/no) [yes] CPAN::Reporter: sending test report with 'unknown' via Metabase MLEHMANN/Canary-Stability-2012.tar.gz /usr/bin/make test -- OK Running make install Manifying 1 pod document Installing /Users/ken/perl5/perlbrew/perls/perl-5.24.0t/lib/site_perl/ +5.24.0/Canary/Stability.pm Installing /Users/ken/perl5/perlbrew/perls/perl-5.24.0t/man/man3/Canar +y::Stability.3 Appending installation info to /Users/ken/perl5/perlbrew/perls/perl-5. +24.0t/lib/5.24.0/darwin-thread-multi-2level/perllocal.pod MLEHMANN/Canary-Stability-2012.tar.gz /usr/bin/make install -- OK MLEHMANN/JSON-XS-3.02.tar.gz Has already been unwrapped into directory /Users/ken/.cpan/build/JSO +N-XS-3.02-0 Configuring M/ML/MLEHMANN/JSON-XS-3.02.tar.gz with Makefile.PL *** *** Canary::Stability COMPATIBILITY AND SUPPORT CHECK *** ================================================= *** *** Hi! *** *** I do my best to provide predictable and reliable software. *** *** However, in recent releases, P5P (who maintain perl) have been *** introducing regressions that are sometimes subtle and at other tim +es *** catastrophic, often for personal preferences with little or no con +cern *** for existing code, most notably CPAN. *** *** For this reason, it has become very hard for me to maintain the le +vel *** of reliability and support I have committed myself to in the past, + at *** least with some perl versions: I simply can't keep up working arou +nd new *** bugs or gratituous incompatibilities, and in turn you might suffer + from *** unanticipated problems. *** *** Therefore I have introduced a support and compatibility check, the + results *** of which follow below, together with a FAQ and some recommendation +s. *** *** This check is just to let you know that there might be a risk, so +you can *** make judgement calls on how to proceed - it will not keep the modu +le from *** installing or working. *** *** The stability canary says: (nothing, it was driven away by harsh w +eather) *** *** It seems you are running perl version 5.024000, likely the "offici +al" or *** "standard" version. While there is nothing wrong with doing that, *** standard perl versions 5.022 and up are not supported by JSON::XS. *** While this might be fatal, it might also be all right - if you run + into *** problems, you might want to downgrade your perl or switch to the *** stability branch. *** *** If everything works fine, you can ignore this message. *** *** Stability canary mini-FAQ: *** *** Do I need to do anything? *** With luck, no. While some distributions are known to fail *** already, most should probably work. This message is here *** to alert you that your perl is not supported by JSON::XS, *** and if things go wrong, you either need to downgrade, or *** sidegrade to the stability variant of your perl version, *** or simply live with the consequences. *** *** What is this canary thing? *** It's purpose is to check support status of JSON::XS with *** respect to your perl version. *** *** What is this "stability branch"? *** It's a branch or fork of the official perl, by schmorp, to *** improve stability and compatibility with existing modules. *** *** How can I skip this prompt on automated installs? *** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment. *** More info is in the Canary::Stability manpage. *** *** Long version of this FAQ: http://stableperl.schmorp.de/faq.html *** Stability Branch homepage: http://stableperl.schmorp.de/ *** Continue anyways? [y] ... I did continue and eventually got a successful installation messag +e ... MLEHMANN/JSON-XS-3.02.tar.gz /usr/bin/make install -- OK
As the installation ran to completion, I tried your script and got:
$ pm_1175565_json_xs_sv_chop_panic.pl End of document 1 panic: sv_chop ptr=7faa01441e79, start=7faa0140eb30, end=7faa0140ecf0 +at ./pm_1175565_json_xs_sv_chop_panic.pl line 41, <DATA> chunk 886.
The "panic: sv_chop %s" diagnostic was introduced in v5.12 (see "perl5120delta: New Diagnostics"):
- panic: sv_chop %s
This new fatal error occurs when the C routine Perl_sv_chop() was passed a position that is not within the scalar's string buffer. This could be caused by buggy XS code, and at this point recovery is not possible.
I don't have sufficient knowledge of Perl's 'C' internals to help further on that front.
You could try installing JSON::XS under a version of Perl earlier than v5.22; however, given ++stevieb's results under v5.16.3, you should probably look more closely at your script for other issues.
Also note that the current version of JSON (2.90) has (in its VERSION section):
"This version is compatible with JSON::XS 2.34 and later. (Not yet compatble to JSON::XS 3.0x.)"
So, perhaps you might have more success with earlier versions of both Perl and JSON::XS.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: JSON::XS parsing error when incrementally parsing JSON file - "panic: sv_chop"
by ateague (Monk) on Nov 09, 2016 at 22:43 UTC |