ID:               37120
 User updated by:  brlcad at mac dot com
 Reported By:      brlcad at mac dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Apache2 related
 Operating System: FreeBSD 5.2.1
 PHP Version:      5.1.2
 New Comment:

I'll give that a try, though this is on a very heavy 
loaded production machine (hundreds of web hits per 
minute) -- I'll need to wait for the load to settle a 
little, hopefully later tonight.

That said, in the meantime I thought I'd share some more 
insight testing.  I fully replaced sendmail with qmail 
to make sure it wasn't something particular with the 
configuration of sendmail.  Again, the machine has no 
problems sending e-mail on the command line or with mail 
clients, but mod_php5 hangs on the mail() call.  

Curiously enough, before installing qmail if I made the 
clientmqueue dir unreadable so that sendmail reported an 
error/failure, the mail() call does return immediately 
(reporting a failure return code) so the hanging does 
seem to be specific to when the mail 'should' go through 
correctly.


Previous Comments:
------------------------------------------------------------------------

[2006-04-18 21:30:49] [EMAIL PROTECTED]

Please try to reproduce it with only one Apache process (httpd -X) and
if yes - get a GDB backtrace of the place where it freezes.

------------------------------------------------------------------------

[2006-04-18 15:12:04] brlcad at mac dot com

When I attempt to use the sendmail binary directly, I 
have no problems:
$ /usr/local/sbin/sendmail -t -i -v -X /tmp/sendmail.log 
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Subject: this is a test...

testing.
[CTRL-d]

The message is successfully delivered both with and 
without the above shown header provided.  Looking at the 
-X debug logs, the difference running the command 
directly versus what I'm seeing when php runs is a lack 
of the EOF, shown below as follows:

>From PHP:
70503 <<< To: [EMAIL PROTECTED]
70503 <<< Subject: Hi!
70503 <<< 
70503 <<< Hi,
70503 <<< 
76330 <<< To: [EMAIL PROTECTED]
76330 <<< Subject: Hi!
76330 <<< 
76330 <<< Hi,
76330 <<< 
76330 <<< How are you?

(Notice the lack of an EOF, it hangs)

Directly on the command line:

40466 <<< From: [EMAIL PROTECTED]
40466 <<< To: [EMAIL PROTECTED]
40466 <<< Subject: testing
40466 <<< 
40466 <<< testing2
40466 <<< [EOF]
40466 >>> [EMAIL PROTECTED] Connecting to 
[127.0.0.1] via relay...
40466 === CONNECT [127.0.0.1]

------------------------------------------------------------------------

[2006-04-18 14:14:06] [EMAIL PROTECTED]

I suspect it has nothing to do with PHP and everything to do 
with the sendmail binary. It maybe hanging waiting for data, 
try to test the sendmail binary to see if it can be used to 
send e-mail.

------------------------------------------------------------------------

[2006-04-18 13:06:21] brlcad at mac dot com

Description:
------------
Using a default install of mod_php5 on FreeBSD, installed 
via an up-to-date ports, web pages calling mail() hang 
indefintely.  This ends up hanging the associated apache 
process until it is manually killed.  I can send mail fine 
from mail clients on the host, from mod_perl, by telnetting 
to port 25, just apparently not from mod_php5.

I've tested using the default php.ini mail settings as well 
as setting sendmail_path explicitly with different debug 
options (e.g. /usr/local/sbin/sendmail -t -i -v -X /tmp/
sendmail.log).  Sendmail does log that a connection is 
established and the e-mail is written to the log, but it 
never closes the connection and only aborts when apache is 
killed.

This bug seems very familiar with php bug 22947 yet I'm not 
on Windows so perhaps just coincidence.

Reproduce code:
---------------
<?php
$to = "[EMAIL PROTECTED]";
$subject = "Hi!";
$body = "Hello?";

echo("<p>sending mail</p>");

if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}
?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37120&edit=1

Reply via email to