Reputation: 225
I have been migrating from a rhel6 server with Perl 5.10 to a server with rhel8 and perl 5.24 and 5.26.
Everything works fine except one Perl program crashes executing a warn statement.
Using the built in debugger, I traced the error to the line below. Entering n to step over the subroutine terminated execution.
File::Temp::cleanup(/usr/share/perl5/vendor_perl/File/Temp.pm:934):
934: @{ $dirs_to_unlink{$$} } = ()
DB<44> n
The sub function with the warn statement that fails is:
sub add_rec_to_db {
my $info = shift;
# Returns (errorcode, errormsg). No errorcode means GOOD.
my $af_rec = Logs::stats_transform($info);
my $lpd = Logs::db_lpd();
my $db_file = "$lpd/persistent.db";
my $dbh = LogsCommon::open_db($db_file);
my $err = LogsCommon::sql_insert_or_update($dbh, $af_rec, 'all_recs', 'FID');
if ($err) {
if ($err =~ /database is locked/) {
return "DATABASE_IS_LOCKED";
}
$err = strip_special_chars($err);
warn "AddRecToDb: FID=$info->{REC_ID} UNRECOGNIZED_DB_ERROR: $err";
return "UNRECOGNIZED_DB_ERROR";
}
return undef;
}
The Perl program executes without error if I change the parameters so it doesn't run this section of code. DBI and DBD seem to be installed and working correctly. Even for the sub function that crashes, the code does what it should, until the warn statement. After executing the warn statement, it should return "UNRECOGNIZED_DB_ERROR".
Using module streams to switch from Perl 5.26 to 5.24 didn't resolve this issue.
Upvotes: 2
Views: 478
Reputation: 225
The program exits because of Carp settings:
use Carp qw(confess);
$SIG{__DIE__} = \&confess;
$SIG{__WARN__} = \&confess;
It did not exit on the Rhel 6 server because the $err variable wasn't raised. I will post a new question if I cannot determine why the $err was raised on the Rhel8 server, but not the Rhel6 server.
Upvotes: 1