action #90371
closed
Warnings "Subroutine JSON::PP::Boolean::(0+ redefined"
Added by tinita about 4 years ago.
Updated about 3 years ago.
Category:
Regressions/Crashes
Description
Currently the openQA fullstack tests show these warnings:
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(-- redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
https://app.circleci.com/pipelines/github/os-autoinst/openQA/5998/workflows/94c76040-f055-4899-8372-bd5d3f416a50/jobs/56590
https://app.circleci.com/pipelines/github/os-autoinst/openQA/5998/workflows/94c76040-f055-4899-8372-bd5d3f416a50/jobs/56591
The reason seems to be that Cpanel::JSON::XS creates the JSON::PP::Boolean namespace and overloads without using the module. Then when JSON::PP is used, perl sees that the overloads have already been defined.
https://github.com/rurban/Cpanel-JSON-XS/issues/65
perl -wE 'use Cpanel::JSON::XS (); use JSON::PP ()'
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(-- redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
The reason in our case seems to be the following:
- It only happens with Devel::Cover
- Devel::Cover uses JSON::MaybeXS (which then uses Cpanel::JSON::XS)
- Some other code in our code base or in CPAN modules used by us is using JSON::PP
- Related to action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instances added
- Related to action #38264: os-autoinst-distri-opensuse self-tests fail in travis CI with "Subroutine JSON::PP::Boolean::(0+ redefined" but not locally added
- Related to action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-scheduler added
A quick "fix" can be to use JSON::PP before everything else in the Makefile when using Devel::Cover:
COVEROPT ?= -MJSON::PP -MDevel::Cover=-select_re
The fact that these warnings only appear in fullstack tests suggest, that in os-autoinst code we are using JSON::PP somewhere (directly or indirectly via CPAN modules) after Devel::Cover loads Cpanel::JSON::XS, and in openQA we either never use JSON::PP, or it is used before Devel::Cover loads Cpanel::JSON::XS. I don't know yet at which point Devel::Cover loads the module.
The warning is harmless, but annoying and distracting from potentially less harmless warnings.
Another question would be why Test::Warnings doesn't catch that. No idea so far.
tinita wrote:
A quick "fix" can be to use JSON::PP before everything else in the Makefile when using Devel::Cover:
export PERL5OPT="-MJSON::PP -MDevel::Cover...
Assuming we only need this when we collect coverage, COVEROPT
could be used (this gets added to PERL5OPT then), which is where we add Cover as well.
yeah, I actually meant COVEROPT, this was a copy&paste mistake.
- Status changed from New to In Progress
- Assignee set to tinita
- Target version changed from future to Ready
- Status changed from In Progress to Feedback
- Status changed from Feedback to Resolved
- Status changed from Resolved to Feedback
- Status changed from Feedback to Resolved
Also available in: Atom
PDF