简体   繁体   English

mod_perl 分段错误

[英]mod_perl segmentation fault

HI,你好,

I'm running an apache 2.2.3 on an Oracle64-bit (Red Hat clone) and I'm hitting a brick wall with an issue.我在 Oracle64 位(Red Hat 克隆)上运行 apache 2.2.3,但我遇到了问题。 I have a program which utilizes MIME::Lite to send mail through sendmail (I apologize, not sure what versions of sendmail or mod_perl I'm running, although I do believe the sendmail portion is irrelevant as you'll see in a moment)我有一个程序,它利用 MIME::Lite 通过 sendmail 发送邮件(我很抱歉,不确定我正在运行什么版本的 sendmail 或 mod_perl,尽管我相信 sendmail 部分与您稍后会看到的无关)

On occasion, apache will segfault (11), and digging deep into the MIME::Lite module, I see it is on the following line:有时,apache 会出现段错误 (11),并深入挖掘 MIME::Lite 模块,我看到它在以下行:

open SENDMAIL, "|$sendmailcmd" or Carp::croak "open |$sendmailcmd: $!\n";  (this is in MIME::Lite)

Now, one would automatically suspect sendmail, but if I did the same line to use /bin/cat (as shown):现在,人们会自动怀疑 sendmail,但如果我使用相同的行来使用 /bin/cat(如图所示):

open SENDMAIL, "|/bin/cat" 

apache still segfaults. apache 仍然有段错误。

I attached an strace to the apache processes and see the following: (when it does NOT crash)我在 apache 进程上附加了一个 strace 并看到以下内容:(当它没有崩溃时)

12907 write(2, "SENDMAIL send_by_sendmail 1\n", 28) = 28
12907 write(2, "SENDMAIL /usr/lib/sendmail -t -o"..., 40) = 40
12907 pipe([24, 26])                    = 0
12907 pipe([28, 29])                    = 0
12907 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,     child_tidptr=0x2b4bcbbd75d0) = 13186

Note the "SENDMAIL sent_by_sendmail" are my comments.请注意“SENDMAIL sent_by_sendmail”是我的评论。 You can clearly see pipes opening.您可以清楚地看到管道开口。 When it DOES crash, you'll see the following:当它崩溃时,您将看到以下内容:

10805 write(2, "SENDMAIL send_by_sendmail (for y"..., 40) = 40
10805 --- SIGSEGV (Segmentation fault) @ 0 (0) ---

Now notice it never pipes.现在注意它从不管道。 I've tried GDB and it hasn't really shown me anything.我试过 GDB,但它并没有真正向我展示任何东西。

Finally, I wrote a simple program to run through mod_perl and regular cgi:最后,我写了一个简单的程序来运行 mod_perl 和常规的 cgi:

 print header();
 print "test";

 open SENDMAIL, "|/bin/cat" or Carp::croak "open |sendmailcmd: $!\n";
 print SENDMAIL "foodaddy";
 close SENDMAIL;
 print "test done <br/>";

Under mod_perl it has successfully crashed.在 mod_perl 下,它已成功崩溃。

My analysis is telling me it has to do with it trying to open a file handle, the piping function returns either false or a corrupt file handle.我的分析告诉我这与它试图打开文件句柄有关,管道函数返回 false 或损坏的文件句柄。

I also increased the file descriptor limit to 2048, no dice.我还将文件描述符限制增加到 2048,没有骰子。

Does anyone have any thoughts as to where I should look?有没有人对我应该去哪里有任何想法? Any thoughts?有什么想法吗?

I appreciate the help我感谢帮助

I managed to treat perhaps only the symptoms, not the cause.我设法可能只治疗症状,而不是原因。 I happened to have this issue when used global/package scope variables on the package level, used inside a perl object instance, as soon as I passed them as object properties instead, not as automatic default perl variables scoping, I stopped to experience perl segmentation fault suddenly.在包级别使用全局/包范围变量时,我碰巧遇到了这个问题,在 perl 对象实例中使用,一旦我将它们作为对象属性传递,而不是作为自动默认的 perl 变量范围,我就停下来体验 perl 分段故障突然。

I just spent a long time tracking down a problem that started with identical symptoms.我只是花了很长时间来追踪一个以相同症状开始的问题。 I eventually discovered that Test::More does not play well with mod_perl .我最终发现 Test::More 不能很好地与 mod_perl 配合使用。 Removing this module from my code appears to have solved the problem (so far!).从我的代码中删除这个模块似乎已经解决了这个问题(到目前为止!)。 I didn't follow this any deeper, but I suspect that the problem actually lies in Test::Builder.我没有更深入地遵循这一点,但我怀疑问题实际上出在 Test::Builder 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM