Edit report at https://bugs.php.net/bug.php?id=64934&edit=1

 ID:                 64934
 Updated by:         a...@php.net
 Reported by:        37xzxz at gmail dot com
 Summary:            Apache2 with php5apache2_4.dll crash when use
                     get_browser()
-Status:             Assigned
+Status:             Verified
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Win 7 x64 SP1, WinServ 2008 R2
 PHP Version:        5.4Git-2013-05-27 (snap)
 Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

I got the bt now, looks like it crashes on rshutdown freeing the browser object

        php5ts_debug.dll!gc_remove_from_buffer(_gc_root_buffer * root, void * * 
* tsrm_ls) Line 189     C
        php5ts_debug.dll!gc_remove_zval_from_buffer(_zval_struct * zv, void * * 
* tsrm_ls) Line 265     C
        php5ts_debug.dll!_zval_ptr_dtor(_zval_struct * * zval_ptr, const char * 
__zend_filename, const unsigned int __zend_lineno) Line 437     C
        php5ts_debug.dll!_zval_ptr_dtor_wrapper(_zval_struct * * zval_ptr) Line 
182     C
        php5ts_debug.dll!zend_hash_destroy(_hashtable * ht) Line 560    C
>       php5ts_debug.dll!zend_object_std_dtor(_zend_object * object, void * * * 
> tsrm_ls) Line 44        C
        php5ts_debug.dll!zend_objects_free_object_storage(_zend_object * 
object, void * * * tsrm_ls) Line 137   C
        php5ts_debug.dll!zend_objects_store_del_ref_by_handle_ex(unsigned int 
handle, const _zend_object_handlers * handlers, void * * * tsrm_ls) Line 
221     C
        php5ts_debug.dll!zend_objects_store_del_ref(_zval_struct * zobject, 
void * * * tsrm_ls) Line 173        C
        php5ts_debug.dll!_zval_dtor_func(_zval_struct * zvalue, const char * 
__zend_filename, const unsigned int __zend_lineno) Line 54 C
        php5ts_debug.dll!_zval_dtor(_zval_struct * zvalue, const char * 
__zend_filename, const unsigned int __zend_lineno) Line 35      C
        php5ts_debug.dll!_zval_ptr_dtor(_zval_struct * * zval_ptr, const char * 
__zend_filename, const unsigned int __zend_lineno) Line 438     C
        php5ts_debug.dll!_zval_ptr_dtor_wrapper(_zval_struct * * zval_ptr) Line 
182     C
        php5ts_debug.dll!zend_hash_apply_deleter(_hashtable * ht, bucket * p) 
Line 650  C
        php5ts_debug.dll!zend_hash_reverse_apply(_hashtable * ht, int (void *, 
void * * *) * apply_func, void * * * tsrm_ls) Line 804   C
        php5ts_debug.dll!shutdown_destructors(void * * * tsrm_ls) Line 217      
C
        php5ts_debug.dll!zend_call_destructors(void * * * tsrm_ls) Line 922     
C
        php5ts_debug.dll!php_request_shutdown(void * dummy) Line 1742   C
        php5apache2_4.dll!php_apache_request_dtor(request_rec * r, void * * * 
tsrm_ls) Line 507 C
        php5apache2_4.dll!php_handler(request_rec * r) Line 679 C


Previous Comments:
------------------------------------------------------------------------
[2013-05-29 06:44:36] 37xzxz at gmail dot com

@ab, I use full_php_browscap.ini
http://tempdownloads.browserscap.com/stream.asp?Full_PHP_BrowscapINI

and Apache/2.4.4 (Win32) OpenSSL/0.9.8y from http://www.apachelounge.com/

------------------------------------------------------------------------
[2013-05-28 15:16:31] a...@php.net

@37xzxz what kind of browscap.ini do you use?

------------------------------------------------------------------------
[2013-05-28 08:34:41] paj...@php.net

@a can you take a look at that please?

------------------------------------------------------------------------
[2013-05-28 08:26:04] 37xzxz at gmail dot com

Also error windows, may be it will be helpful http://puu.sh/328qt.png

------------------------------------------------------------------------
[2013-05-28 07:45:15] 37xzxz at gmail dot com

Description:
------------
Tested on php-5.4.15-Win32-VC9-x86 and 5.4.17-dev snapshot 
(http://windows.php.net/downloads/snaps/php-5.4/rbcdac75/php-5.4-ts-windows-vc9-
x86-rbcdac75.zip)

Apache2 crashes when code contain get_browser() and script called multiply 
times in parallel.

[mpm_winnt:notice] [pid 3684:tid 440] AH00428: Parent: child process 4032 
exited 
with status 3221225477 -- Restarting.

I perfom search in Google and find this 
http://stackoverflow.com/questions/1138269/apache-error-notice-parent-child-
process-exited-with-status-3221225477-res

pylon said: "I just figured it out that the get_browser() function gives a 
memory error sometimes".

So I perfom tests part of code with get_browser() only and reproduce crashes.

Test script:
---------------
test.php contain code:

<?php
echo $_SERVER[ 'HTTP_USER_AGENT' ] . ' '. time() . "\n";
$browser = get_browser( $_SERVER[ 'HTTP_USER_AGENT' ] );
?>

test_get_browser.php on other server

<?php
set_time_limit( 0 );

$opts = array(
        'http' => array(
                'method' => "GET",
                'header' => "User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) 
AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31\r\n",
                ),
        );
$context = stream_context_create( $opts );

$url = 'http://testserver/test.php';

for( $i = 0; $i < 10000; $i++ ) {
        $data = file_get_contents( $url, false, $context );
        echo $data;
}
?>

Run few copies of test_get_browser.php to emulate many clients.

Expected result:
----------------
No crashes, all requests will be served normally.

Actual result:
--------------
Apache2 crashes when I call 2-7 copies of test_get_browser.php.

Thread 11 - System ID 4556
Entry point   libhttpd!ap_regkey_value_remove+1060 
Create time   28.05.2013 11:02:43 
Time spent in user mode   0 Days 0:0:0.62 
Time spent in kernel mode   0 Days 0:0:0.0 

Full Call Stack

Function     Arg 1     Arg 2     Arg 3     Arg 4   Source 
ntdll!NtRaiseException+12     0c58eeec     0c58ef3c     00000000     c0000005   
 
ntdll!KiUserExceptionDispatcher+29     0c58eeec     0c58ef3c     00000000     
c0000005    

Exception Information
PHP5TS!_ZVAL_PTR_DTOR+3C8In 
httpd__PID__9884__Date__05_28_2013__Time_11_02_44AM__426__Second_Chance_Exceptio
n_C0000005.dmp the assembly instruction at php5ts!_zval_ptr_dtor+3c8 in 
C:\dev\php-5.4.15-Win32-VC9-x86\php5ts.dll from The PHP Group has caused an 
access violation exception (0xC0000005) when trying to read from memory 
location 
0x0e6dc8a4 on thread 11

Same code work fine on Ubuntu 12.04, I can't find any errors in logs.


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



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

Reply via email to