简体   繁体   中英

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

On occasion, apache will segfault (11), and digging deep into the MIME::Lite module, I see it is on the following line:

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

open SENDMAIL, "|/bin/cat" 

apache still segfaults.

I attached an strace to the apache processes and see the following: (when it does NOT crash)

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

Finally, I wrote a simple program to run through mod_perl and regular 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.

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.

I also increased the file descriptor limit to 2048, no dice.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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