Patrick
Patrick

Reputation: 628

DBD::Oracle causing corruption to System calls?

Seeing some strange behavior, whereby connecting to Oracle database, and then calling external function, the value of $? is always -1.
Problem machine is running standard AIX5.3, with DBD::Oracle 1.20 and DBI 1.602.

#!/usr/bin/perl -w
use DBI;

CORE::system "pwd";
print "Before connect: $?\n";
DBI->connect('dbi:Oracle:', 'pwd', 'pwd');
print "Before system: $?\n";
CORE::system "pwd";
print "After system: $?\n";
CORE::system "pwd";
print "After system: $?\n";

Before connect: 0
Before system: 0
/usr/local/bin
After system: -1
/usr/local/bin
After system: -1

This is the results from a different AIX 5.3 machine, the only difference I can see is that it is running DBD:Oracle 1.22 and DBI 1.607. However looking at the change logs for those modules, I can't see anything that could relate to that. Any ideas for further things I can try other than upgrading DBD:Oracle and DBI (hesitent to do that straight away as this is a production machine).

Upvotes: 1

Views: 448

Answers (2)

Dan
Dan

Reputation: 1

I realise this posting is several months after the fact, but since I have encountered the same problem, I'll detail my workaround for anyone who stumbles on your post.

Different versions of the Oracle OCI libraries handle SIGCHILD separately (e.g. I have your problem with 11gR2 but not 11gR1). If you avoid using bequeath connections by changing

DBI->connect('dbi:Oracle:', 'pwd', 'pwd');

to

DBI->connect('dbi:Oracle:', 'pwd', 'pwd');

you'll find your problem goes away. Of course, you may not want to connect by going through the listener, but I don't have a solution for that...

Upvotes: 0

Chas. Owens
Chas. Owens

Reputation: 64919

from perldoc -f system:

Return value of -1 indicates a failure to start the program or an error of the wait(2) system call (inspect $! for the reason).

It looks like the system call is not able to exec the pwd program anymore. Try changing your system calls to:

my $rc = system "pwd";
if ($rc == -1) {
    die "system call failed: $!";
} elsif ($rc & 0b0000_0000_0111_1111) {
    die "system call died due to signal ", $rc & 0b0000_0000_0111_1111;
} elsif ($rc & 0b1111_1111_0000_0000) {
    warn "system call returned non-zero exit code: ", $rc >> 8;
}

Upvotes: 1

Related Questions