php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20985 heavy load = Segmentation fault
Submitted: 2002-12-13 03:47 UTC Modified: 2003-01-01 01:00 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:3 of 5 (60.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: jfl at eksperten dot dk Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.3.0RC3 OS: Redhat Linux 7.3 & 8
Private report: No CVE-ID: None
 [2002-12-13 03:47 UTC] jfl at eksperten dot dk
[Fri Dec 13 10:17:36 2002] [notice] child pid 15954 exit signal Segmentation fault (11)

I get several lines like the above when I have heavy load on the server. This also happens whith php 4.2.3

In the test i used:
Compaq P4 1.6ghz, 256mb ram
Redhat Linux 7.3, kernel 2.4.18-18.8.0
Apache 1.3.27
Php 4.3.0RC3 & 4.2.3
MySQL 4.0.5a

Stress tool: http://webtool.rte.microsoft.com/

I configured php like this:
./configure --with-apache=../apache-1.3.27 --with-mysql=/usr --enable-trans-sid --enable-inline-optimization --without-pear

'make test' made no errors.

Please let me know what I can do to help you fix this bug.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-13 03:49 UTC] jfl at eksperten dot dk
I get these errors on both Redhat Linux 7.3 & 8
 [2002-12-13 03:55 UTC] jfl at eksperten dot dk
I have tested this on different machines, so I do not think that this is a hardware error.
 [2002-12-13 04:06 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.
 [2002-12-13 07:42 UTC] jfl at eksperten dot dk
[root@spinaker root]# gdb /usr/local/apache/bin/httpd
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x401ac9af in memcpy () from /lib/libc.so.6
(gdb) bt
#0  0x401ac9af in memcpy () from /lib/libc.so.6
#1  0x0810c512 in _mem_block_check ()
#2  0x0810c4d5 in _mem_block_check ()
#3  0x0810b72f in _efree ()
#4  0x0811af00 in _zval_dtor ()
#5  0x08111d0a in free_zend_constant ()
#6  0x0812167d in zend_hash_del_key_or_index ()
#7  0x08121f38 in zend_hash_reverse_apply ()
#8  0x08112113 in clean_non_persistent_constants ()
#9  0x0811290c in shutdown_executor ()
#10 0x0811c0c6 in zend_deactivate ()
#11 0x08079fbc in php_request_shutdown ()
#12 0x08127e82 in apache_php_module_main ()
#13 0x080774dc in php_restore_umask ()
#14 0x08077535 in php_restore_umask ()
#15 0x08149dc3 in ap_invoke_handler ()
#16 0x0815ed47 in ap_some_auth_required ()
#17 0x0815f16b in ap_internal_redirect ()
#18 0x0806bc3c in ap_get_server_built ()
#19 0x08149dc3 in ap_invoke_handler ()
#20 0x0815ed47 in ap_some_auth_required ()
#21 0x0815eda8 in ap_process_request ()
#22 0x08155be5 in ap_child_terminate ()
---Type <return> to continue, or q <return> to quit---
#23 0x08155d90 in ap_child_terminate ()
#24 0x08155f04 in ap_child_terminate ()
#25 0x0815657c in ap_child_terminate ()
#26 0x08156ddf in main ()
#27 0x401481c4 in __libc_start_main () from /lib/libc.so.6
(gdb)
 [2002-12-13 08:42 UTC] iliaa@php.net
Are you using PHP sessions, if so what session handler are you using?
 [2002-12-13 08:52 UTC] jfl at eksperten dot dk
I use files as my session handler. Have also tried with mm, but I think the same happens here.
 [2002-12-13 09:47 UTC] jfl at eksperten dot dk
I have now tested with RPMs from Redhat:
apache-1.3.27-2.i386.rpm
php-4.1.2-7.3.6.i386.rpm
php-mysql-4.1.2-7.3.6.i386.rpm

And these from MySQL:
MySQL-shared-3.23.54-1.i386.rpm
MySQL-4.0.5-0.i386.rpm

And i get the same error:
[Fri Dec 13 16:45:25 2002] [notice] child pid 1273 exit signal Segmentation fault (11)
 [2002-12-13 09:53 UTC] jfl at eksperten dot dk
I have also submitted a bug report to Redhat:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=79561

I hope that's ok.
 [2002-12-13 09:56 UTC] iliaa@php.net
Could you please compile your PHP with --enable-debug, this will make you backtrace contain a lot more information. If you are able to do that then go the step #5 (free_zend_constant) and see what data the various pointers contains. I am especially interested in seeing what constant is being freed and if it is the same one everytime.
 [2002-12-13 16:40 UTC] jfl at eksperten dot dk
> Could you please compile your PHP with --enable-debug
I have done so.

> If you are able to do that then go the step #5
> (free_zend_constant) and see what data the various
> pointers contains.
> I am especially interested in seeing what constant is
> being freed and if it is the same one everytime.

Could you instruct me on how to do this? 
My knowledge only covers compiling and the information from here:
http://bugs.php.net/bugs-generating-backtrace.php
 [2002-12-13 16:53 UTC] iliaa@php.net
Go to the php directory, inside that directory edit a file called config.nice, one line above the line, which contains "$@" add the following line:
'--enable-debug' \
now do:
rm config.cache; make clean; ./config.nice; make; make install

You've now compiled & installed PHP that contains debugging symbols, when a crash occurs you should be able to see more detailed information when analyzing core files generated due to crash in PHP.
To see data at a certain step use gdb command such as frame 5, which will take you to a particular frame, list command, which will show the source code at this point and then p command to print the values of various variables & pointers.
 [2002-12-13 19:14 UTC] jfl at eksperten dot dk
If php is built into apache, where should I then be able to find a core file?
apache is here: /usr/local/apache/bin
 [2002-12-14 13:51 UTC] jfl at eksperten dot dk
This is what I get every time with Php 4.2.3 compiled into Apache.
More info @ http://test.webalogic.net/bugs/
I think the bug is happening when Apache is trying to kill children, as the SIGSEGV is happening when the stress tool is finished.

(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X

Program received signal SIGSEGV, Segmentation fault.
0x4207c46c in memcpy () from /lib/i686/libc.so.6
(gdb) bt
#0  0x4207c46c in memcpy () from /lib/i686/libc.so.6
#1  0x081041d0 in _mem_block_check ()
#2  0x08104197 in _mem_block_check ()
#3  0x081034a1 in _efree ()
#4  0x0811283c in _zval_dtor ()
#5  0x08109bac in free_zend_constant ()
#6  0x08118c29 in zend_hash_del_key_or_index ()
#7  0x081194a6 in zend_hash_reverse_apply ()
#8  0x08109fb4 in clean_non_persistent_constants ()
#9  0x0810a780 in shutdown_executor ()
#10 0x0811387f in zend_deactivate ()
#11 0x08078500 in php_request_shutdown ()
#12 0x0811f192 in apache_php_module_main ()
#13 0x080761cc in php_restore_umask ()
#14 0x08076237 in php_restore_umask ()
#15 0x08140990 in ap_invoke_handler ()
#16 0x08154d86 in ap_some_auth_required ()
#17 0x08154de6 in ap_process_request ()
#18 0x0814c0aa in ap_child_terminate ()
#19 0x0814c24a in ap_child_terminate ()
#20 0x0814c3b1 in ap_child_terminate ()
#21 0x0814c9de in ap_child_terminate ()
#22 0x0814d1fc in main ()
---Type <return> to continue, or q <return> to quit---
#23 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) frame 5
#5  0x08109bac in free_zend_constant ()
(gdb) list
1       <unknown>: No such file or directory.
        in <unknown>
(gdb) p
The history is empty.
(gdb)
 [2002-12-14 13:59 UTC] jfl at eksperten dot dk
I'll now start testing Php-4.3.0RC3
 [2002-12-14 16:22 UTC] jfl at eksperten dot dk
By starting Apache, with built in Php-4.3.0RC3, with 'gdb /usr/local/apache/bin/httpd' I can not make it crash.
But if I start Apache normally I get a Segmentation fault in the error_log. Please see the bottom of http://test.webalogic.net/bugs/error_log_php4-3 (2mb)

What can I do to help you further?
 [2002-12-14 23:37 UTC] iliaa@php.net
Could you provide copies of the list.phtml & info.phtml scripts?
 [2002-12-15 13:21 UTC] jfl at eksperten dot dk
The files has been sent to iliaa@php.net.

If none of my scripts has errors I can not get SIGSEGV. But I get "Last leak repeated X times". Have a look at http://test.webalogic.net/bugs/error_log-no_SIGSEGV and the other files at http://test.webalogic.net/
 [2002-12-15 21:34 UTC] iliaa@php.net
This is a fairly big script and I cannot even run it fully because I am missing over a dosen various includes your script requires. Is there any way you could reduce this to a single, preferably short script that could be used to replicate the memory leak you are seeing?
 [2002-12-16 07:42 UTC] jfl at eksperten dot dk
I can give you access to the system. Would you like that?

I have also sent an email to iliaa@php.net regarding this.
 [2002-12-16 15:58 UTC] iliaa@php.net
I appreciate your offer, but it would be much better if you could narrow down the problem. There is just too much code to go over.
 [2002-12-18 12:53 UTC] jfl at eksperten dot dk
I'll do my best.
 [2003-01-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, 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".
 [2003-01-08 09:11 UTC] jfl at eksperten dot dk
With Php 4.3.0 I am not getting any Segmentation faults, but when I compile with --enable-debug I still get "Last leak repeated X times".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC