Hello Peter,
I found the line on which the production script crashed today.
It's basically, when the second parameter of a calculation is not initiated:
#!/usr/bin/perl
use bigint;
use strict;
use warnings;
printf "%20s %s\n", "Perl", $];
for my $file (sort keys %INC) {
my $mod = $file;
$mod =~ s|\.pm$||;
$mod =~ s|/|::|g;
printf "%20s %s\n", $mod, $mod -> VERSION() // 'undef'; }
my %testhash = ();
my @testarray = ();
my $testscalar;
print "\nDEBUG:Addition:\n--------------\n";
print "\nDEBUG:Test hash:\n";
$testhash{test}+=3;
print "\nDEBUG:Test array:\n";
$testarray[1]+=3;
print "\nDEBUG:Test scalar:\n";
$testscalar+=3;
my $testscalar2;
print "\nDEBUG:Substraction:\n--------------\n";
print "\nDEBUG:Test scalar: ".(1-$testscalar2)."\n";
my $testscalar3;
print "\nDEBUG:Multiplication:\n--------------\n";
print "\nDEBUG:Test scalar: ".(1*$testscalar3)."\n";
my $testscalar4;
print "\nDEBUG:Division:\n--------------\n";
print "\nDEBUG:Test scalar: ".(1/$testscalar4)."\n";
print "FIN\n";
Output of the script (concatenated, because of the crashes):
Rose:/opt/perl # perl test_bigint.pl
Perl 5.018002
Carp 1.29
Exporter 5.68
Exporter::Heavy 5.68
Math::BigInt 1.999809
Math::BigInt::Calc 1.999809
Math::BigInt::Lib 1.999809
bigint 0.47
constant 1.27
integer 1.00
overload 1.22
overloading 0.02
strict 1.07
vars 1.03
warnings 1.18
warnings::register 1.02
DEBUG:Addition:
--------------
DEBUG:Test hash:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
DEBUG:Test array:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
DEBUG:Test scalar:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
DEBUG:Substraction:
--------------
Can't call method "is_zero" on an undefined value at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1578.
DEBUG:Multiplication:
--------------
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1609.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1612.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1627.
Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt/Calc.pm line 483.
DEBUG:Division:
--------------
Can't call method "is_nan" on an undefined value at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1716.
Of course division by undefined/zero will always cause an error, so this surely is the least critical one. But with only that error given it is very hard to find the corresponding line on large scripts.
Thanks/regards,
Stefan Welscher
Show quoted text-----Ursprüngliche Nachricht-----
Von: Welscher, Stefan
Gesendet: Dienstag, 21. Februar 2017 16:14
An: 'bug-Math-BigInt@rt.cpan.org'
Betreff: AW: [rt.cpan.org #120240] Warnings from BigInt.pm: Use of uninitiated value
Hello Peter,
thank you for the reply.
The output of your addon is as follows:
Rose:/opt/perl # perl test_bigint.pl
Perl 5.018002
Carp 1.29
Exporter 5.68
Exporter::Heavy 5.68
Math::BigInt 1.999809
Math::BigInt::Calc 1.999809
Math::BigInt::Lib 1.999809
bigint 0.47
constant 1.27
integer 1.00
overload 1.22
overloading 0.02
strict 1.07
vars 1.03
warnings 1.18
warnings::register 1.02
DEBUG:Test hash:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
DEBUG:Test array:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
DEBUG:Test scalar:
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1525.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1527.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.18.2/Math/BigInt.pm line 1536.
FIN
This output was created on a test system.
On production environment, we deactivated "use warnings" in BigInt.pm to get rid of the warnings (we couldn't find a way for a quick rollback).
The modules loaded with the test script are:
Perl 5.010000
Carp 1.38
Exporter 5.72
Exporter::Heavy 5.72
Math::BigInt 1.999809
Math::BigInt::Calc 1.999809
Math::BigInt::Lib 1.999809
bigint 0.47
constant 1.33
integer 1.00
overload 1.06
strict 1.04
warnings 1.06
warnings::register 1.01
But today we also had a crash on the production script more or less caused by the BigInt-Module:
" Can't call method "is_zero" on an undefined value at /usr/lib/perl5/5.10.0/Math/BigInt.pm line 1578."
Because this error happens in the middle of >130.000 lines of code I was not yet able to specify a line causing it.
On the production script, the following modules are loaded (I had to skip the Version method, because I got 'Can't call method "VERSION" without a package or object reference'):
(I delete our own modules from the output)
Perl 5.010000
::usr::lib::perl5::5.10.0::x86_64-linux-thread-multi::auto::POSIX::autosplit.ix
::usr::lib::perl5::5.10.0::x86_64-linux-thread-multi::auto::POSIX::load_imports.al
::usr::lib::perl5::vendor_perl::5.10.0::x86_64-linux-thread-multi::auto::Net::SSLeay::autosplit.ix
::usr::lib::perl5::vendor_perl::5.10.0::x86_64-linux-thread-multi::auto::Net::SSLeay::randomize.al
Algorithm::Diff
Archive::Zip
Archive::Zip::Archive
Archive::Zip::DirectoryMember
Archive::Zip::FileMember
Archive::Zip::Member
Archive::Zip::NewFileMember
Archive::Zip::StringMember
Archive::Zip::ZipFileMember
AutoLoader
Carp
Carp::Heavy
Compress::Raw::Bzip2
Compress::Raw::Zlib
Config
Config_heavy.pl
Convert
Cwd
DBI
Data::Dumper
DynaLoader
Encode
Encode::Alias
Encode::Config
Encode::Encoding
Errno
Excel::Writer::XLSX
Excel::Writer::XLSX::Chart
Excel::Writer::XLSX::Chartsheet
Excel::Writer::XLSX::Drawing
Excel::Writer::XLSX::Format
Excel::Writer::XLSX::Package::App
Excel::Writer::XLSX::Package::Comments
Excel::Writer::XLSX::Package::ContentTypes
Excel::Writer::XLSX::Package::Core
Excel::Writer::XLSX::Package::Custom
Excel::Writer::XLSX::Package::Packager
Excel::Writer::XLSX::Package::Relationships
Excel::Writer::XLSX::Package::SharedStrings
Excel::Writer::XLSX::Package::Styles
Excel::Writer::XLSX::Package::Table
Excel::Writer::XLSX::Package::Theme
Excel::Writer::XLSX::Package::VML
Excel::Writer::XLSX::Package::XMLwriter
Excel::Writer::XLSX::Shape
Excel::Writer::XLSX::Utility
Excel::Writer::XLSX::Workbook
Excel::Writer::XLSX::Worksheet
Expect
Exporter
Exporter::Heavy
Fcntl
File::Basename
File::Copy
File::Find
File::Glob
File::GlobMapper
File::Path
File::Spec
File::Spec::Unix
File::Temp
FileHandle
IO
IO::Compress::Adapter::Bzip2
IO::Compress::Adapter::Deflate
IO::Compress::Adapter::Identity
IO::Compress::Base
IO::Compress::Base::Common
IO::Compress::Bzip2
IO::Compress::Gzip::Constants
IO::Compress::RawDeflate
IO::Compress::Zip
IO::Compress::Zip::Constants
IO::Compress::Zlib::Extra
IO::File
IO::Handle
IO::Pty
IO::Seekable
IO::Select
IO::Socket
IO::Socket::INET
IO::Socket::INET6
IO::Socket::SSL
IO::Socket::UNIX
IO::Stty
IO::Tty
IO::Tty::Constant
List::Util
MIME::Base64
Math::BigInt
Math::BigInt::Calc
Math::BigInt::Lib
Net::DNS
Net::DNS::Domain
Net::DNS::DomainName
Net::DNS::Header
Net::DNS::Packet
Net::DNS::Parameters
Net::DNS::Question
Net::DNS::RR
Net::DNS::Resolver
Net::DNS::Resolver::Base
Net::DNS::Resolver::UNIX
Net::DNS::Update
Net::SSLeay
POSIX
Scalar::Util
SelectSaver
Socket
Socket6
Symbol
Text::Diff
Tie::Hash
Time::Local
WWW::Curl
WWW::Curl::Easy
XSLoader
autouse
base
bigint
bytes
constant
integer
lib
overload
parent
re
strict
utf8
vars
warnings
warnings::register
I hope this helps you on debugging.
Thanks/regards,
Stefan Welscher
-----Ursprüngliche Nachricht-----
Von: Peter John Acklam via RT [mailto:bug-Math-BigInt@rt.cpan.org]
Gesendet: Dienstag, 21. Februar 2017 14:41
An: Welscher, Stefan
Betreff: [rt.cpan.org #120240] Warnings from BigInt.pm: Use of uninitiated value
<URL:
https://rt.cpan.org/Ticket/Display.html?id=120240 >
I have run your program with every combination of Math::BigInt, Math::BigInt::Lite, and bignum that I have installed on my system, and I am not able to reproduce what you are seeing.
I tried each version of Math::BigInt from version 1.999701 to version 1.999809 with each version of Math::BigInt::Lite from version 0.03 to version 0.16 with each version of bignum from version 0.05 to 0.47.
Perhaps you can run the following script and show me the output. The program displays the name and version of every module that is loaded when the program runs.
#!/usr/bin/perl
use strict;
use warnings;
use bigint;
printf "%20s %s\n", "Perl", $];
for my $file (sort keys %INC) {
my $mod = $file;
$mod =~ s|\.pm$||;
$mod =~ s|/|::|g;
printf "%20s %s\n", $mod, $mod -> VERSION() // 'undef'; }
my %testhash = ();
my @testarray = ();
my $testscalar;
print "\nDEBUG:Test hash:\n";
$testhash{test}+=3;
print "\nDEBUG:Test array:\n";
$testarray[1]+=3;
print "\nDEBUG:Test scalar:\n";
$testscalar+=3;
print "FIN\n";