ID:               40479
 Comment by:       pablo at dalloglio dot net
 Reported By:      rrossi at maggioli dot it
 Status:           No Feedback
 Bug Type:         Reproducible crash
 Operating System: Suse Linux 9.0
 PHP Version:      5.2.1
 New Comment:

This script may help to reproduce the bug.
It is a stupid script, but sometimes the two
generated files (teste.txt, teste1.txt)
are different. But they should be identical.

<?php
file_put_contents('teste.txt',
str_repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 10000));

$output = file_get_contents('teste.txt');

for ($n=1; $n<=10000; $n++)
{
    $output = str_replace('G', 'G', $output);
}
file_put_contents('teste2.txt', $output);
?>


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

[2008-12-12 20:10:29] peter at f-is dot eu

I have run into this problem too. I have not been able to make a short
example script to demonstrate the problem since removing seemingly
unrelated parts of code makes the problem disappear.

The error is generated after the PHP script has completed. The actual
problem seems to stem from calling a some static method from a class
that has not yet been included. The class is included by an __autoload
function. Manually including the class first seems to fix the problem,
but doing random stuff in general seems to do that :)

The problem occurs when returning from the function, since throwing an
exception or die()-ing at that point does not show the problem.

When building php with --enable-debug, the problem goes away. The
problem also goes away when not using --enable-debug, but adding
-DZEND_MM_HEAP_PROTECTION.

Since the problem goes away when using --enable-debug, I generated the
following backtraces with a modified zend_mm_panic(...) in zend_alloc.c
to remove the #if ZEND_DEBUG macro.

#0  0x00007f9b736d45a7 in kill () from /lib/libc.so.6
#1  0x0000000000596440 in zend_mm_panic (message=<value optimized out>)
at /usr/local/src/php-5.2.8/Zend/zend_alloc.c:94
#2  0x0000000000596a45 in _zend_mm_free_int (heap=0x96f300, p=0xb) at
/usr/local/src/php-5.2.8/Zend/zend_alloc.c:833
#3  0x00000000005bc298 in zend_hash_destroy (ht=0xd71040) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#4  0x00000000005cbb49 in zend_object_std_dtor (object=0xd6c570) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#5  0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#6  0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=63) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#7  0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6ffe8)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#8  0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xd79d38) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#9  0x00000000005bc298 in zend_hash_destroy (ht=0xcf42f8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#10 0x00000000005b12bf in _zval_dtor_func (zvalue=0xd77118) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#11 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xb74de0) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#12 0x00000000005bc298 in zend_hash_destroy (ht=0xd01938) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#13 0x00000000005cbb49 in zend_object_std_dtor (object=0xd6cc88) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#14 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#15 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=62) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#16 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6e378)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#17 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xd79e70) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#18 0x00000000005bc298 in zend_hash_destroy (ht=0xd7a3d8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#19 0x00000000005b12bf in _zval_dtor_func (zvalue=0xd7a3b0) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#20 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xb6e258) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#21 0x00000000005bc298 in zend_hash_destroy (ht=0xd71800) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#22 0x00000000005cbb49 in zend_object_std_dtor (object=0xd6e150) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#23 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#24 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=61) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#25 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6df98)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#26 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xcf5db8) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#27 0x00000000005bc298 in zend_hash_destroy (ht=0xcf5bc8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#28 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcf5ba0) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#29 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce8400) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#30 0x00000000005bc298 in zend_hash_destroy (ht=0xc96598) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#31 0x00000000005cbb49 in zend_object_std_dtor (object=0xccafd0) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#32 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#33 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=38) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#34 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcb2090)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#35 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xccb418) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#36 0x00000000005bc298 in zend_hash_destroy (ht=0xcccbf0) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#37 0x00000000005b12bf in _zval_dtor_func (zvalue=0xc95d00) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#38 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce8c10) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#39 0x00000000005bc298 in zend_hash_destroy (ht=0xccc3c8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#40 0x00000000005cbb49 in zend_object_std_dtor (object=0xc96e50) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#41 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#42 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=36) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#43 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xccd2a8)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#44 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xcddd50) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#45 0x00000000005bc298 in zend_hash_destroy (ht=0xcccb28) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#46 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcb2118) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#47 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce63d0) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#48 0x00000000005bc298 in zend_hash_destroy (ht=0xccb4b8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#49 0x00000000005cbb49 in zend_object_std_dtor (object=0xccc298) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#50 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#51 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=32) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#52 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcd4e28)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#53 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xbec940) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#54 0x00000000005bc298 in zend_hash_destroy (ht=0xc06770) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#55 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcccb80) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#56 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce7a90) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#57 0x00000000005bc298 in zend_hash_destroy (ht=0xccd2d0) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#58 0x00000000005cbb49 in zend_object_std_dtor (object=0xcca568) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#59 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#60 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle
(handle=27) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206
#61 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcca998)
at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168
#62 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce68d0) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#63 0x00000000005bc298 in zend_hash_destroy (ht=0xcb2700) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#64 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcb26d8) at
/usr/local/src/php-5.2.8/Zend/zend_variables.c:43
#65 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xc53520) at
/usr/local/src/php-5.2.8/Zend/zend_variables.h:35
#66 0x00000000005bc298 in zend_hash_destroy (ht=0xc066b8) at
/usr/local/src/php-5.2.8/Zend/zend_hash.c:526
#67 0x00000000005cbb49 in zend_object_std_dtor (object=0xc00878) at
/usr/local/src/php-5.2.8/Zend/zend_objects.c:45
#68 0x00000000005cbb69 in zend_objects_free_object_storage
(object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122
#69 0x00000000005ced51 in zend_objects_store_free_object_storage
(objects=0x96dce0) at
/usr/local/src/php-5.2.8/Zend/zend_objects_API.c:89
#70 0x00000000005a529c in shutdown_executor () at
/usr/local/src/php-5.2.8/Zend/zend_execute_API.c:299
#71 0x00000000005b18e2 in zend_deactivate () at
/usr/local/src/php-5.2.8/Zend/zend.c:860
#72 0x000000000057017e in php_request_shutdown (dummy=<value optimized
out>) at /usr/local/src/php-5.2.8/main/main.c:1492
#73 0x000000000063596d in main (argc=1, argv=0x7fff7e8a86b8) at
/usr/local/src/php-5.2.8/sapi/cgi/cgi_main.c:2052


----
The following backtrace was generated by 'shell_exec('kill -s SEGV
'.getmypid());' inside the function that causes the problem when it
return's. It might be usefull

#0  0x00007f55d4f458ab in fork () from /lib/libc.so.6
#1  0x00007f55d4f125ad in _IO_proc_open () from /lib/libc.so.6
#2  0x00007f55d4f12819 in popen () from /lib/libc.so.6
#3  0x0000000000518a17 in zif_shell_exec (ht=<value optimized out>,
return_value=0xdaf568, return_value_ptr=<value optimized out>,
this_ptr=<value optimized out>,
    return_value_used=<value optimized out>) at
/usr/local/src/php-5.2.8/ext/standard/exec.c:462
#4  0x00000000005e0af7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fffe00af9c0) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:200
#5  0x00000000005d0923 in execute (op_array=0xdb1c00) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#6  0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fffe00b0530) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234
#7  0x00000000005d0923 in execute (op_array=0xd9b770) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#8  0x0000000000604b2f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER
(execute_data=0x7fffe00b0d00) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:20105
#9  0x00000000005d0923 in execute (op_array=0xb70de8) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#10 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fffe00b1230) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234
#11 0x00000000005d0923 in execute (op_array=0xb24548) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#12 0x0000000000604b2f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER
(execute_data=0x7fffe00b1460) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:20105
#13 0x00000000005d0923 in execute (op_array=0xb385b8) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#14 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fffe00b1a70) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234
#15 0x00000000005d0923 in execute (op_array=0xb37e98) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#16 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fffe00b2540) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234
#17 0x00000000005d0923 in execute (op_array=0xb213e0) at
/usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92
#18 0x00000000005b15dd in zend_execute_scripts (type=8, retval=<value
optimized out>, file_count=3) at
/usr/local/src/php-5.2.8/Zend/zend.c:1134
#19 0x000000000056f948 in php_execute_script
(primary_file=0x7fffe00b6cc0) at
/usr/local/src/php-5.2.8/main/main.c:2023
#20 0x0000000000636532 in main (argc=1, argv=0x7fffe00b6ec8) at
/usr/local/src/php-5.2.8/sapi/cgi/cgi_main.c:1989

If there is anything I can to to help to resolve this issue, please
ask.

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

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/40479

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

Reply via email to