DBD::Oracle 导致系统调用损坏?

发布于 2024-07-27 04:42:07 字数 660 浏览 7 评论 0原文

看到一些奇怪的行为,连接到Oracle数据库,然后调用外部函数,$?的值? 始终为 -1。
问题机器运行标准 AIX5.3,带有 DBD::Oracle 1.20 和 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

这是来自不同 AIX 5.3 机器的结果,我能看到的唯一区别是它运行的是 DBD:Oracle 1.22 和 DBI 1.607。 然而,查看这些模块的更改日志,我看不到任何与之相关的内容。 除了升级 DBD:Oracle 和 DBI 之外,我还可以尝试任何进一步的想法(犹豫是否立即这样做,因为这是一台生产机器)。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恏ㄋ傷疤忘ㄋ疼 2024-08-03 04:42:07

来自perldoc -f system

返回值 -1 表示启动程序失败或 wait(2) 系统调用错误(检查 $! 查找原因)。< /p>

看起来系统调用无法再 exec pwd 程序。 尝试将您的系统调用更改为:

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;
}

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;
}
吃颗糖壮壮胆 2024-08-03 04:42:07

我意识到这篇文章是在几个月后发布的,但由于我遇到了同样的问题,我将为任何偶然发现您的文章的人详细介绍我的解决方法。

不同版本的Oracle OCI 库分别处理SIGCHILD(例如,我在11gR2 上遇到问题,但在11gR1 上没有)。 如果您通过更改

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

来避免使用遗赠连接 到

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

你会发现你的问题消失了。 当然,您可能不想通过侦听器进行连接,但我没有解决方案......

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文