php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30770 php mail() causes apache to temporarily 'crash'
Submitted: 2004-11-13 01:42 UTC Modified: 2004-12-14 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chris at christopher-dean dot co dot uk Assigned:
Status: No Feedback Package: Apache2 related
PHP Version: 5.0.2 OS: FreeBSD 5.2.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-11-13 01:42 UTC] chris at christopher-dean dot co dot uk
Description:
------------
I am using php 5.0.2 with apache 2.0.52 on freebsd 5.2.1-RELEASE

whenever the mail() is invoked in a php script e.g. by clicking submit on a mail form, apache 'crashes' (although it doesn't die completely, maybe it restarts?) and this error of this form is produced in the logs:

www kernel: pid 20225 (httpd), uid 80: exited on signal 6

Any ideas what I can do to fix this if it isn't a bug within php itself?

Reproduce code:
---------------
<?	if(empty($_POST['name']))
		echo "The name field was empty. Please click back and fill in your name";
	else if(empty($_POST['email']))
		echo "The email field was empty. Please click back and fill in your email address";
	else if(empty($_POST['message']))
		echo "You did not enter a message. Please click back and write us a message";
	else
	{
		$headers = "From: ".$_POST['name']." <".$_POST['email'].">\r\n"
                ."reply-to:".$_POST['email']."\r\n";

		mail("example@emailaddress.com", "Message from the Media website", $_POST['message'], $headers);	
?>
<p>Thank you for your message, we will be in contact shortly if nessary.</p>

Expected result:
----------------
the thank you message appear on the page

Actual result:
--------------
I get the page cannot be displayed message from internet explorer indicating apache's basically not running, but on refresh the orginal email us submittal form comes up blank as if it has ben loaded up for the first time (which stands to reason if apache's crashed or restarted). 

FYI: the format of the page is an 'email us' form with the form's action being the same page, then if(isset(Submit)){...} is used execute the mail() when sumbmited. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-13 01:45 UTC] chris at christopher-dean dot co dot uk
Forgot to mention, the email does get sent
 [2004-11-13 01:58 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2004-11-13 10:11 UTC] chris at christopher-dean dot co dot uk
Results of the back trace:
Couldn't get a core file so used method described on webpage for people who can't get a core file and this output was produced. Note, this is only the section of the backtrace where the crash occured from running the script in the browser, as prior to this it was all "no debugging symbols found" as apache starts normally:

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


(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...
Program received signal SIGABRT, Aborted.
0x283bddcf in kill () from /lib/libc.so.5
(gdb) bt
#0  0x283bddcf in kill () from /lib/libc.so.5
#1  0x283b2878 in raise () from /lib/libc.so.5
#2  0x2842af82 in abort () from /lib/libc.so.5
#3  0x2962a565 in _thread_exit () from /usr/lib/libc_r.so.5
#4  0x29628345 in _thread_kern_sig_undefer () from /usr/lib/libc_r.so.5
#5  0x29627a94 in _thread_kern_sched_state_unlock () from /usr/lib/libc_r.so.5
#6  0x29627445 in _thread_kern_scheduler () from /usr/lib/libc_r.so.5

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

I hope this helps
 [2004-12-07 00:59 UTC] jorton@php.net
Are you using the worker MPM?  Threads on FreeBSD are historically a bit flaky. Google finds random similar backtraces from e.g. ruby users, FWIW.
 [2004-12-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-03-11 11:27 UTC] phil dot brennan at gmail dot com
Hi, I get the exact same error as chris. I'm running the same release of freebsd, apache 2.0.53 and php 4.3.10.
Apache2 on freebsd is built with the prefork mpm. Thats what I'm using. I realise that this may be a freebsd issue, but it is strange that this is the only part of php that is affected. I suppose its time for me to start digging through the source to php mail() now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 05:01:31 2024 UTC