1

I had a simple perl scrip that runs some DB opertions on using DBD::Oracle package and also forks some processes. Child processes also connects with DB but creates there own DBH object. This was working fine until I migrated from Linux RH4 to Linux RH6. With OS migration perl version also changed from 5.8 to 5.10. On migration I face error as foll following:

DBD::Oracle::db DESTROY failed: ORA-03135: connection lost contact
Process ID: 1984105
Session ID: 1511 Serial number: 32085 (DBD ERROR: OCITransRollback) during global      destruction.

My perl script:

$dbh = DBI->connect("DBI:Oracle:$server", "$username", "$password") or die "Couldn't connect to database: " . DBI->errstr;

$dbh->{AutoCommit} = 0;

load_metrics(); # here I do some DB operations using $dbh

##Create ForkManager instance with number of child processes equal to batches
my $pm = new Parallel::ForkManager(15);

for ($proc_num = 100; $proc_num >= 1; $proc_num--)
{
    $pm->start($proc_num) and next;

    printf localtime(). " [$PID] Start sampling for Metric\n";
    system("./sample_impl.pl");
    printf localtime()." [$PID] Finished Resampling Metric\n";
    $pm->finish;
}

printf localtime(). " [$PID] Parent process waiting for Child processes\n";

$pm->wait_all_children;

print localtime()." "."sampling Finished\n";

The above error gets repeated 100 times.

If I remove ForkManager scrpts works just fine. I am not sharing DBH in Parent with Child, hence I am bit surprised to see this error.

Please advice on reason of this error and how to get this fixed.

4

0 回答 0