Project

General

Profile

Actions

action #90371

closed

Warnings "Subroutine JSON::PP::Boolean::(0+ redefined"

Added by tinita about 3 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2021-03-19
Due date:
% Done:

0%

Estimated time:

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 issues 3 (0 open3 closed)

Related to openQA Project - action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instancesResolvedokurz2020-09-18

Actions
Related to openQA Tests - action #38264: os-autoinst-distri-opensuse self-tests fail in travis CI with "Subroutine JSON::PP::Boolean::(0+ redefined" but not locallyResolvedokurz2018-07-06

Actions
Related to openQA Project - action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-schedulerResolvedkraih2017-12-07

Actions
Actions #1

Updated by tinita about 3 years ago

  • Related to action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instances added
Actions #2

Updated by tinita about 3 years ago

  • 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
Actions #3

Updated by tinita about 3 years ago

  • Related to action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-scheduler added
Actions #4

Updated by tinita about 3 years ago

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.

Actions #5

Updated by tinita about 3 years ago

Another question would be why Test::Warnings doesn't catch that. No idea so far.

Actions #6

Updated by livdywan about 3 years ago

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.

Actions #7

Updated by tinita about 3 years ago

yeah, I actually meant COVEROPT, this was a copy&paste mistake.

Actions #8

Updated by tinita about 3 years ago

  • Status changed from New to In Progress
  • Assignee set to tinita
  • Target version changed from future to Ready
Actions #10

Updated by tinita about 3 years ago

  • Status changed from In Progress to Feedback
Actions #11

Updated by tinita about 3 years ago

  • Status changed from Feedback to Resolved

PR was merged

Actions #12

Updated by tinita about 2 years ago

  • Status changed from Resolved to Feedback

We also have the problem in isotovideo during tests.
PR: https://github.com/os-autoinst/os-autoinst/pull/2005

Newer versions of JSON::PP avoid the warnings, so I think with the next perl version this could be fixed.

Actions #13

Updated by tinita about 2 years ago

  • Status changed from Feedback to Resolved

merged

Actions

Also available in: Atom PDF