php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18743 Pushing values to an array dies with large number of elements
Submitted: 2002-08-05 13:59 UTC Modified: 2002-10-24 01:00 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: mgrommet at yahoo dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.2.2 OS: Linux Redhat 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mgrommet at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-08-05 13:59 UTC] mgrommet at yahoo dot com
I have an object with a method that performs a mysql search.

It collects values from the search results, and pushes them on to an array to return.

This code works great for smaller query results, but it causes a segmentation fault with larger numbers (approximately 1300 results)

Running PHP 4.2.2
Apache 1.3.6 (mod_frontpage, mod_rewrite)
MySQL 3.23.43

--- EXAMPLE CODE ---

     $mailDbLink = mysql_connect($mailserver,$mailuser,$mailpass) or die("Could not connect to mail system");
     mysql_select_db($maildbname) or die("Could not select appropriate database in 98-11 system");

     $query = mysql_query($processEmailTableSql) or die("Could not perform 98-11 search: " . mysql_error());

     while($row = mysql_fetch_array($query))
     {
        array_push($resultsArray,$row["MessageID"]);
     }

     return $resultsArray;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-05 14:32 UTC] sander@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-08-07 00:16 UTC] mgrommet at yahoo dot com
Requested backtrace

Starting program: /usr/local/apache_fp/bin/httpd -X

Program received signal SIGSEGV, Segmentation fault.
0x4207acc0 in chunk_free () from /lib/i686/libc.so.6
(gdb) bt
#0  0x4207acc0 in chunk_free () from /lib/i686/libc.so.6
#1  0x4207ac24 in free () from /lib/i686/libc.so.6
#2  0x4014608e in _efree (ptr=0x836d6bc, __zend_filename=0x402c8761 "./zend_execute.c", __zend_lineno=449,
    __zend_orig_filename=0x402c9273 "zend_variables.c", __zend_orig_lineno=44) at zend_alloc.c:246
#3  0x4016153e in _zval_dtor (zvalue=0x8205b14, __zend_filename=0x402c8761 "./zend_execute.c", __zend_lineno=449) at zend_variables.c:44
#4  0x401570d6 in zend_assign_to_variable (result=0x81539b8, op1=0x81539c8, op2=0x81539d8, value=0x8204e5c, type=4, Ts=0xbfffac88) at ./zend_execute.c:449
#5  0x401519a1 in execute (op_array=0x8150ed4) at ./zend_execute.c:1346
#6  0x40152997 in execute (op_array=0x8151d2c) at ./zend_execute.c:1638
#7  0x40152997 in execute (op_array=0x81387ac) at ./zend_execute.c:1638
#8  0x401633b8 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:810
#9  0x40175bda in php_execute_script (primary_file=0xbffff708) at main.c:1381
#10 0x40170626 in apache_php_module_main (r=0x812c794, display_source_mode=0) at sapi_apache.c:90
#11 0x40171494 in send_php (r=0x812c794, display_source_mode=0, filename=0x812d37c "/home/server-real1/html/98-11_search_results.php") at mod_php4.c:575
#12 0x40171501 in send_parsed_php (r=0x812c794) at mod_php4.c:590
#13 0x08055ff3 in ap_invoke_handler ()
#14 0x0806a8f9 in process_request_internal ()
#15 0x0806a95c in ap_process_request ()
#16 0x08061a6e in child_main ()
#17 0x08061c00 in make_child ()
#18 0x08061d59 in startup_children ()
#19 0x080623b6 in standalone_main ()
#20 0x08062b83 in main ()
#21 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)
 [2002-09-18 19:41 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-09-19 12:14 UTC] mgrommet at yahoo dot com
Tried using new snapshot...  In essence, the query did work, but it took a very very long time (order of ~20 minutes, no exaggeration) to deliever the results of a query with 7000~ results (I'm only returning an array with integer keys, pushing each one on)

During this time, apache refused to parse any php pages... it seemed to be only paying attention to that one instance of httpd

In addition, I had some of these in my apache error logs:

[root@klaxon logs]# tail -f error_log
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(568) :  Freeing 0x08142D4C (12 bytes), script=/home/server-real1/html/security_check.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(568) :  Freeing 0x08148D2C (12 bytes), script=/home/server-real1/html/userfunctions.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(420) :  Freeing 0x081832EC (12 bytes), script=/home/server-real1/html/userfunctions.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(420) :  Freeing 0x08149A44 (12 bytes), script=/home/server-real1/html/98-11_search.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(568) :  Freeing 0x081846B4 (12 bytes), script=/home/server-real1/html/98-11_search.php
Last leak repeated 2 times


/usr/local/src/phpsnap/php4-200209190600/Zend/zend_operators.c(1008) :  Freeing 0x4081702C (2169914 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(420) :  Freeing 0x08146364 (12 bytes), script=/home/server-real1/html/security_check.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(568) :  Freeing 0x08142D34 (12 bytes), script=/home/server-real1/html/security_check.php
Last leak repeated 2 times
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/ext/standard/reg.c(482) :  Freeing 0x083C0F94 (102 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(568) :  Freeing 0x0824118C (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1597) :  Freeing 0x081BED44 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 8 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1740) :  Freeing 0x0815CD34 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 4 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(906) :  Freeing 0x081DF2C4 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_hash.c(440) :  Freeing 0x0815BBFC (64 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 4 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1743) :  Freeing 0x0815160C (9 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/standard/string.c(709) :  Freeing 0x0823CD5C (38 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/ext/pcre/php_pcre.c(790) :  Freeing 0x081E079C (29 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(682) :  Freeing 0x08246144 (5 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 7855 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_operators.c(1040) :  Freeing 0x4060502C (2169914 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1173) :  Freeing 0x081C8E54 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_hash.c(262) :  Freeing 0x083CF77C (44 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 58 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_hash.c(1056) :  Freeing 0x0817D72C (18 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(478) :  Freeing 0x0819C874 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(681) :  Freeing 0x08218D1C (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 7855 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1808) :  Freeing 0x0824544C (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/ext/standard/string.c(805) :  Freeing 0x08177814 (432 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(467) :  Freeing 0x081A2E04 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 3 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(753) :  Freeing 0x081694FC (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 7 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_hash.c(406) :  Freeing 0x083C0C8C (35 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 7853 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_hash.c(178) :  Freeing 0x08164BCC (32 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 4 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1992) :  Freeing 0x081CF10C (44 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(565) : Actual location (location was relayed)
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(2015) :  Freeing 0x081B1B3C (29 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
Last leak repeated 6 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(2012) :  Freeing 0x081B1994 (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 6 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1623) :  Freeing 0x081B18D4 (44 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(597) :  Freeing 0x081F63F4 (44 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(585) : Actual location (location was relayed)
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_execute.c(1961) :  Freeing 0x08153FAC (12 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_operators.c(1047) :  Freeing 0x08153E6C (13 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_compile.c(1663) :  Freeing 0x081FBDDC (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 3 times
Zend/zend_language_scanner.c(4560) :  Freeing 0x081FBC54 (1 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 80 times
Zend/zend_language_parser.c(2860) :  Freeing 0x081FB604 (44 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_API.c(565) : Actual location (location was relayed)
/usr/local/src/phpsnap/php4-200209190600/ext/session/session.c(420) :  Freeing 0x081FAEFC (12 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 2 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_opcode.c(295) :  Freeing 0x081E7BAC (22980 bytes), script=/home/server-real1/html/98-11_search_results.php
Zend/zend_language_scanner.c(4433) :  Freeing 0x081F7FC4 (7 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 18 times
Zend/zend_language_scanner.c(4425) :  Freeing 0x081F7ED4 (4 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 96 times
Zend/zend_language_scanner.c(3860) :  Freeing 0x081F7E9C (6 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 34 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_compile.c(1746) :  Freeing 0x081B4DC4 (13 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_compile.c(1730) :  Freeing 0x081B4D4C (13 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
Last leak repeated 1 time
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_opcode.c(230) :  Freeing 0x081B4CC4 (24 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_compile.c(843) :  Freeing 0x082089F4 (18 bytes), script=/home/server-real1/html/98-11_search_results.php
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_variables.c(111) : Actual location (location was relayed)
Zend/zend_language_scanner.c(4773) :  Freeing 0x081650F4 (2 bytes), script=/home/server-real1/html/98-11_search_results.php
Last leak repeated 3 times
/usr/local/src/phpsnap/php4-200209190600/Zend/zend_opcode.c(65) :  Freeing 0x081800FC (4 bytes), script=/home/server-real1/html/98-11_search_results.php
Zend/zend_language_scanner.c(3054) :  Freeing 0x08164974 (84 bytes), script=/home/server-real1/html/98-11_search_results.php
 [2002-10-08 22:35 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-24 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC