php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41777 Segmentation Fault when calling mail()
Submitted: 2007-06-22 07:41 UTC Modified: 2007-07-04 01:00 UTC
From: diego dot malatesta at mottaeditore dot it Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.2.3 OS: Ubuntu Server 7.04 (Sparc)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-06-22 07:41 UTC] diego dot malatesta at mottaeditore dot it
Description:
------------
When I run the script the browser asks me if I want to save the file or view it as if I were downloading it and I get a blank page.

Reproduce code:
---------------
<?php
mail("to.someone@somesite.com","bla","blabla");
?>

Expected result:
----------------
I expect the mail to be sent =)

Actual result:
--------------
Apache reports this in the error_log file:

[Fri Jun 22 10:22:01 2007] [notice] child pid 22502 exit signal Segmentation fault (11)
[Fri Jun 22 10:22:01 2007] [notice] child pid 22503 exit signal Segmentation fault (11)


The Backtrace:

(gdb) run -X
Starting program: /usr/local/apache2/bin/httpd -X
[Thread debugging using libthread_db enabled]
[New Thread -134829856 (LWP 22573)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -134829856 (LWP 22573)]
_zval_ptr_dtor (zval_ptr=0xfff1ef9c) at /root/php-5.2.3/Zend/zend_execute_API.c:412
412             (*zval_ptr)->refcount--;
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0xfff1ef9c) at /root/php-5.2.3/Zend/zend_execute_API.c:412
#1  0xf79541ec in zend_do_fcall_common_helper_SPEC (execute_data=0xfff1f034) at /root/php-5.2.3/Zend/zend_execute.h:155
#2  0xf7944860 in execute (op_array=0x20af60) at /root/php-5.2.3/Zend/zend_vm_execute.h:92
#3  0xf7922ac0 in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3) at /root/php-5.2.3/Zend/zend.c:1134
#4  0xf78dc7dc in php_execute_script (primary_file=0xfff1f110) at /root/php-5.2.3/main/main.c:1794
#5  0xf79ad374 in php_handler (r=0x246b40) at /root/php-5.2.3/sapi/apache2handler/sapi_apache2.c:623
#6  0x0003fb4c in ap_run_handler (r=0x246b40) at config.c:157
#7  0x00042c28 in ap_invoke_handler (r=0x246b40) at config.c:372
#8  0x00058744 in ap_process_request (r=0x246b40) at http_request.c:258
#9  0x000557ac in ap_process_http_connection (c=0x242b70) at http_core.c:184
#10 0x000465b0 in ap_run_process_connection (c=0x242b70) at connection.c:43
#11 0x0006b2d4 in child_main (child_num_arg=<value optimized out>) at prefork.c:640
#12 0x0006b4a4 in make_child (s=<value optimized out>, slot=0) at prefork.c:680
#13 0x0006c1c4 in ap_mpm_run (_pconf=0xa40a8, plog=<value optimized out>, s=0xa8c80) at prefork.c:956
#14 0x0002ce3c in main (argc=2, argv=0xfff21ad4) at main.c:717

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-22 08:33 UTC] diego dot malatesta at mottaeditore dot it
PS: Forgot to specify the Sparc platform
 [2007-06-24 17:04 UTC] sniper@php.net
I doubt it's mail() function that is crashing here. Check that you don't have some auto_prepend_file (or append) in php.ini set. And that you don't have any zend_extensions enabled either.
 [2007-06-25 06:50 UTC] diego dot malatesta at mottaeditore dot it
No I don't have any appended or prepended file nor any zend extension enabled.

Btw, I've compiled also php version 5.2.1 and the latest snapshot, but the script keeps crashing.
 [2007-06-25 10:46 UTC] diego dot malatesta at mottaeditore dot it
I've installed php 5.1.6 and the mail() function worked.
Then I put back php 5.2.1 and the script started crashing again.
Back to php 5.1.6 and the script works again.

For now I'm going to use 5.1.6 until there's a bugfix or I find out what's wrong with 5.2.x
 [2007-06-25 16:13 UTC] sniper@php.net
You really tried with that exact script you pasted here?
Try the same with CLI binary..
 [2007-06-26 07:21 UTC] diego dot malatesta at mottaeditore dot it
Yes, the script is exactly that line, to test the mailing capabilities of the server.

I ran it using the CLI binary an it outputs "Segmentation fault".

I actually noticed one think though. For a stupid sendmail misconfiguration, the mails weren't delivered. Now that the configuration is correct, even with the segmentation fault, the mail ARE delivered correctly, both using the CLI binary and the apache module.

I tested other scripts (without the mail() function call) and they work (so I do really think is something related to sendmail (on the sparc platform?)).
 [2007-06-26 07:55 UTC] diego dot malatesta at mottaeditore dot it
"I tested other scripts (without the mail() function call) and they work
(so I do really think is something related to sendmail (on the sparc
platform?))."

Sorry I was wrong with this one.
I realized that I've tested only fairly basic scripts with echoes and a few variables (sorry, I'm trying to debug while configuring this server that has to go on production in a few days).

By running this script:

<?php

$arr = array(1,2,3);
print_r($arr);

?>

for example, I get a segmentation fault. I've captured the backtrace if you need it:

(gdb) run /usr/local/apache2/htdocs/test.php
Starting program: /usr/local/bin/php /usr/local/apache2/htdocs/test.php

Program received signal SIGSEGV, Segmentation fault.
_zval_ptr_dtor (zval_ptr=0xff8a53e4) at /root/php-5.2.3/Zend/zend_execute_API.c:412
412             (*zval_ptr)->refcount--;
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0xff8a53e4) at /root/php-5.2.3/Zend/zend_execute_API.c:412
#1  0x0027bf64 in zend_do_fcall_common_helper_SPEC (execute_data=0xff8a54b4) at /root/php-5.2.3/Zend/zend_execute.h:155
#2  0x0026c5d8 in execute (op_array=0x5e4000) at /root/php-5.2.3/Zend/zend_vm_execute.h:92
#3  0x0024a838 in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3) at /root/php-5.2.3/Zend/zend.c:1134
#4  0x00204554 in php_execute_script (primary_file=0xff8a5590) at /root/php-5.2.3/main/main.c:1794
#5  0x002d5c68 in main (argc=2, argv=0xff8a7ab4) at /root/php-5.2.3/sapi/cli/php_cli.c:1138


As it's clear that is not a mail related bug anymore (I dunno if it can be considered even a bug..), I'll just use php 5.1.6 that works well.

I'll try to help if you think it is worth to investigate into this problem, otherwise you can just close this report.

Thank you for your time.
 [2007-06-26 10:56 UTC] sniper@php.net
What was the configure line you used to configure PHP?

 [2007-06-26 10:58 UTC] diego dot malatesta at mottaeditore dot it
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring --disable-pdo --with-zlib --without-pear
 [2007-06-26 11:25 UTC] tony2001@php.net
This is a known problem on SPARC and it seems to be GCC-related.
IIRC GCC 3.x & 4.1.x work fine, but 4.0.x has some problems with generating a working PHP binary.
What version of GCC are you using and did you try updating it to the latest stable?
 [2007-06-26 12:20 UTC] diego dot malatesta at mottaeditore dot it
"gcc -v" shows:

Using built-in specs.
Target: sparc-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-cpu=v8 --with-long-double-128 --enable-checking=release sparc-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)


It's the ubuntu packaged version that comes with the build-essential package.

According to the gcc site it's the stable release before the current one.

Unfortunately I cannot compile the new version right now as I'm quite full of work :(

I should be able to have a spare SPARC machine and try to compile php with gcc 4.2.0 as soon as I close the project I'm working on right now.
 [2007-07-04 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 04:01:32 2024 UTC