ID:               31624
 User updated by:  ericvanblokland at gmail dot com
 Reported By:      ericvanblokland at gmail dot com
 Status:           Open
 Bug Type:         Session related
 Operating System: Fedora Core 2
 PHP Version:      4CVS-2005-01-22
 New Comment:

This is indeed very interesting, I haven't examined your code
thoroughly yet, but my objects tend to do memory consuming data
processing operations on wakeup. So this issue might be related as
well.

Perhaps you want to post your own bug-report about this, because your
issue is very precise and has its own example code. If you do, please
post a link to your report here, because your issue might as well be
mine.


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

[2005-02-05 15:45:05] bertrand at toggg dot com

I'm experiencing a simpler segfault on PHP4.3.10 FC2 too this way, just
trying to double and again an array:

$arr = array (str_repeat('X', 65536));
$mem = 0;
while ($loop--) {
    for ($i = count($arr); $i; $i--) {
        $arr[] = $arr[0];
        if ($i%16) {
            continue;
        }
        if ( ( ($nmem = memory_get_usage()) - $mem) > 1000000) {
            $mem = $nmem;
            echo 'Count:'.count($arr)." ($mem bytes)<br>\n";
            flush();
        }
    }
    echo $loop.':'.count($arr).'/'.memory_get_usage() . "
bytes<br>\n";
    flush();
}
echo "<br>\n OK <br>\n";
flush();

For 18 loops it breaks my default memory limit of 8 Mo:
Allowed memory size of 8388608 bytes exhausted as expected.

If I add before the loop:
 if (ini_set ('memory_limit', 16*1048576)) {
     echo "Set memory limit to 16 Mo<br>\n";
 }
It's taking an incredible amount of time
and I get segfault.
What is strange, I get the output: 
Set memory limit to 16 Mo
17:2/87456
<...snip...>
Count:256113 (11380680 bytes)
0:262144/11621952 bytes

what means the end of last loop reached.
But I never get the final acknowledgement.

I understand it's much more simpler as yours,
but result is quite near.

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

[2005-02-04 13:05:53] ericvanblokland at gmail dot com

Are you sure this is related to my problem? Do you have any data in
your session? If so, it very well might be related, if you experience
the crash always, no matter what, on session_start(); you should look
for a solution elsewhere.

In my case, the segmentation faults are triggered within the
__wakeup(); functions of my objects that exists in the session. Under
certain conditions the compiler messes up when unserializing the
session (In my last test-run yesterday memory leaks where reported with
a compiler with debug enabled and de segfaults disappeared, without the
debug mode enabled the segfaults returned) causing simple variable
assignments to crash php. 

After a lot of testing I found when not putting certain data in the
session, the segfaults would disappear. However this data has nothing
to do with the crashing object. Unless the data has been referenced. It
shouldn't, but http://bugs.php.net/bug.php?id=24485 might be causing a
reference anyway.

Still, the php compiler contains some very serious bugs, that might be
causing, or causing the conditions which result in a segmentation
fault.

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

[2005-02-04 11:20:15] 1 at movesmountains dot com

Not sure if this is the same bug or not; however, I'm getting a
segfault on every call to session_start(), no matter how trivial the
code ( <? session_start(); ?> will do it).
FreeBSD 4.8-STABLE 
Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7e PHP/4.3.10 

Not sure what other info would be useful to you.

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

[2005-01-23 16:25:03] ericvanblokland at gmail dot com

Some replies seem to be missing in my report...

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

[2005-01-22 16:26:23] ericvanblokland at gmail dot com

Sorry I took so long, apache was annoying me. maxservers was set to 1
but it kept spawning children. It took me a while to attach the right
one to gdb.
Also I recall having to set the maximum allowed memory size to *sick
amount* again. Over 32M! Does an object that takes serialized 3M over
32M during runtime? I might be copying that object somewhere, but not
more than once or twice.

Backtrace for project environment

_zval_ptr_dtor (zval_ptr=0x6) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute_API.c:287
287             (*zval_ptr)->refcount--;
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0x6) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute_API.c:287
#1  0x037c8234 in zend_hash_clean (ht=0x8a301cc) at
/usr/src/php4-STABLE-200501211330/Zend/zend_hash.c:582
#2  0x037d0e24 in execute (op_array=0x876d23c) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1712
#3  0x037d0d8d in execute (op_array=0x8ac0764) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#4  0x037d2000 in execute (op_array=0x8abf7dc) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:2222
#5  0x037c4b83 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/src/php4-STABLE-200501211330/Zend/zend.c:900
#6  0x037a0b50 in php_execute_script (primary_file=0xfefc1940) at
/usr/src/php4-STABLE-200501211330/main/main.c:1739
#7  0x037d4c05 in php_handler (r=0x87336f0) at
/usr/src/php4-STABLE-200501211330/sapi/apache2handler/sapi_apache2.c:550
#8  0x004bac88 in ap_run_handler () from /usr/sbin/httpd
#9  0x085339f8 in ?? ()
#10 0x00000000 in ?? ()

Backtrace for simulated environment (manual imported session)

_zval_ptr_dtor (zval_ptr=0x6e616863) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute_API.c:287
287             (*zval_ptr)->refcount--;
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0x6e616863) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute_API.c:287
#1  0x028c5170 in zend_hash_destroy (ht=0x883950c) at
/usr/src/php4-STABLE-200501211330/Zend/zend_hash.c:556
#2  0x028c0980 in _zval_dtor (zvalue=0x88129a4) at
/usr/src/php4-STABLE-200501211330/Zend/zend_variables.c:60
#3  0x028d08f2 in zend_assign_to_variable (result=0x8a6939c,
op1=0x88129a4, op2=0x8a693bc, value=0x8782c4c, type=4,
    Ts=0xfeeb8e90) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:480
#4  0x028ccc3e in execute (op_array=0x899e354) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1388
#5  0x028cdd8d in execute (op_array=0x8a4b7ac) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#6  0x028cdd8d in execute (op_array=0x8838aac) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#7  0x028cf000 in execute (op_array=0x86f1aa0) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:2222
#8  0x028cdd8d in execute (op_array=0x8a2fa0c) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#9  0x028cdd8d in execute (op_array=0x8a321bc) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#10 0x028cdd8d in execute (op_array=0x8a385bc) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#11 0x028cdd8d in execute (op_array=0x8a3a8e4) at
/usr/src/php4-STABLE-200501211330/Zend/zend_execute.c:1696
#12 0x028c1b83 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/src/php4-STABLE-200501211330/Zend/zend.c:900
#13 0x0289db50 in php_execute_script (primary_file=0xfeec9360) at
/usr/src/php4-STABLE-200501211330/main/main.c:1739
#14 0x028d1c05 in php_handler (r=0x89e4870) at
/usr/src/php4-STABLE-200501211330/sapi/apache2handler/sapi_apache2.c:550
#15 0x00337c88 in ap_run_handler () from /usr/sbin/httpd
#16 0x084679f8 in ?? ()
#17 0x00000000 in ?? ()

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/31624

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

Reply via email to