php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63445 PHP 5.4 crashes in Magento 1.7.0.2 when APC is activated
Submitted: 2012-11-06 08:27 UTC Modified: 2012-11-07 11:06 UTC
From: stoller at leonex dot de Assigned: ab (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5.4.8 OS: Windows 7
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stoller at leonex dot de
New email:
PHP Version: OS:

 

 [2012-11-06 08:27 UTC] stoller at leonex dot de
Description:
------------
Hi,
I have sent this issue already to the internals-win mailing list and was told to create a bug report.
Since I have upgraded PHP to 5.4 on my local test environment (Win7, PHP 5.4.8 TS, APC 3.1.13) Magento seems to crash PHP. When I use PHP 5.3 everything works fine.
I have tried it with PHP as Apache module and with the built-in server. Both results in a crash. Please look at http://www.abload.de/img/php_crashdcknh.png
PHP does not log anything, but in Windows' Event Viewer I get this information:

> Name der fehlerhaften Anwendung: php.exe, Version: 5.4.8.0, Zeitstempel: 0x507dc8a9
> Name des fehlerhaften Moduls: php5ts.dll, Version: 5.4.8.0, Zeitstempel: 0x507dd793
> Ausnahmecode: 0xc0000005
> Fehleroffset: 0x00033f81
> ID des fehlerhaften Prozesses: 0x1b28
> Startzeit der fehlerhaften Anwendung: 0x01cdbbf634edb60a
> Pfad der fehlerhaften Anwendung: C:\Program Files (x86)\PHP\php.exe
> Pfad des fehlerhaften Moduls: C:\Program Files (x86)\PHP\php5ts.dll
> Berichtskennung: 7961b8ea-27e9-11e2-8057-e06995696037

XML Details:
> <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
>   <System>
>     <Provider Name="Application Error" /> 
>     <EventID Qualifiers="0">1000</EventID> 
>     <Level>2</Level> 
>     <Task>100</Task> 
>     <Keywords>0x80000000000000</Keywords> 
>     <TimeCreated SystemTime="2012-11-06T08:10:50.000000000Z" /> 
>     <EventRecordID>272359</EventRecordID> 
>     <Channel>Application</Channel> 
>     <Computer>Lukic-PC.ameusgmbh.intern</Computer> 
>   <Security /> 
>   </System>
>   <EventData>
>     <Data>php.exe</Data> 
>     <Data>5.4.8.0</Data> 
>     <Data>507dc8a9</Data> 
>     <Data>php5ts.dll</Data> 
>     <Data>5.4.8.0</Data> 
>     <Data>507dd793</Data> 
>     <Data>c0000005</Data> 
>     <Data>00033f81</Data> 
>     <Data>1b28</Data> 
>     <Data>01cdbbf634edb60a</Data> 
>     <Data>C:\Program Files (x86)\PHP\php.exe</Data> 
>     <Data>C:\Program Files (x86)\PHP\php5ts.dll</Data> 
>     <Data>7961b8ea-27e9-11e2-8057-e06995696037</Data> 
>   </EventData>
> </Event>

How to reproduce:
I tried to find the reason of the crash by debugging through the code with xdebug, but the crash seems to occur between the last line of PHP code and sending the output to the browser. So the only way to reproduce it, from my point of view, is to install Magento and try it by yourself :-(

Here are the steps:
- Activate APC in PHP
- I have downloaded a fresh Magento (Community Edition, v 1.7.0.2), to be sure that you can reproduce it, from http://www.magentocommerce.com/download
- Then extracted it
- Make the whole magento directory editable for all users (full access)
- Activate APC in Magento by adding this
    <config>
        <global>
            ...
    	    <cache>
                <backend>apc</backend>
                <prefix>dfrhb</prefix>
    	    </cache>
            ...
  to the app\etc\local.xml file 
- start built-in server by:
    $ C:\www\magento>php -S localhost:8000
- Visit http://localhost:8000/index.php
- Magento will redirect you to installation wizard - fill out the form
- After the input of database information and session storage (File System) PHP crashes every time

When I use an already installed Magento, PHP crashes on every second page view (does not matter which page has been called).
When I remove APC from php.ini the error does not occur anymore.

Actual result:
--------------
I tried to install "Debug Diagnostics" but I always get this error message: "Product: Debug Diagnostics 1.2 -- Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RegisterDbgHost, location: C:\Program Files\DebugDiag\DbgHost.exe, command: -RegServer"

So I attached WinDbg to the process of PHP's build-in server.

Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

*** wait with pending attach
Symbol search path is: SRV*"D:\Programme\WinDbg Symbol Path"*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00000000`00260000 00000000`00272000   C:\Program Files (x86)\PHP\php.exe
ModLoad: 00000000`77180000 00000000`77329000   C:\Windows\SYSTEM32\ntdll.dll
ModLoad: 00000000`77360000 00000000`774e0000   ntdll.dll
ModLoad: 00000000`74520000 00000000`7455f000   C:\Windows\SYSTEM32\wow64.dll
ModLoad: 00000000`744c0000 00000000`7451c000   C:\Windows\SYSTEM32\wow64win.dll
ModLoad: 00000000`744b0000 00000000`744b8000   C:\Windows\SYSTEM32\wow64cpu.dll
ModLoad: 00000000`76650000 00000000`76760000   KERNEL32.dll
ModLoad: 00000000`74c40000 00000000`74c87000   KERNELBASE.dll
ModLoad: 00000000`594a0000 00000000`59a88000   php5ts.dll
ModLoad: 00000000`74b50000 00000000`74bf0000   ADVAPI32.dll
ModLoad: 00000000`74aa0000 00000000`74b4c000   msvcrt.dll
ModLoad: 00000000`75040000 00000000`75059000   SECHOST.dll
ModLoad: 00000000`76560000 00000000`76650000   RPCRT4.dll
ModLoad: 00000000`74a40000 00000000`74aa0000   SspiCli.dll
ModLoad: 00000000`74a30000 00000000`74a3c000   CRYPTBASE.dll
ModLoad: 00000000`75350000 00000000`75385000   WS2_32.dll
ModLoad: 00000000`761a0000 00000000`761a6000   NSI.dll 
ModLoad: 00000000`737b0000 00000000`7383c000   ODBC32.dll
ModLoad: 00000000`76880000 00000000`76980000   USER32.dll
ModLoad: 00000000`74db0000 00000000`74e40000   GDI32.dll
ModLoad: 00000000`74f30000 00000000`74f3a000   LPK.dll 
ModLoad: 00000000`75390000 00000000`7542d000   USP10.dll
ModLoad: 00000000`751f0000 00000000`7534c000   ole32.dll
ModLoad: 00000000`73840000 00000000`73884000   DNSAPI.dll
ModLoad: 00000000`73360000 00000000`73403000   MSVCR90.dll
ModLoad: 00000000`75430000 00000000`75490000   IMM32.dll
ModLoad: 00000000`74f40000 00000000`7500c000   MSCTF.dll
ModLoad: 00000000`738b0000 00000000`738e8000   image00000000`738b0000
ModLoad: 00000000`74410000 00000000`7443b000   php_xdebug.dll
ModLoad: 00000000`10000000 00000000`10022000   php_apc.dll
ModLoad: 00000000`74490000 00000000`744a2000   php_bz2.dll
ModLoad: 00000000`74390000 00000000`74403000   php_curl.dll
ModLoad: 00000000`029f0000 00000000`02aef000   LIBEAY32.dll
ModLoad: 00000000`74090000 00000000`74097000   WSOCK32.dll
ModLoad: 00000000`001d0000 00000000`00206000   SSLEAY32.dll
ModLoad: 00000000`74bf0000 00000000`74c35000   WLDAP32.dll
ModLoad: 00000000`73e40000 00000000`74082000   php_fileinfo.dll
ModLoad: 00000000`73cc0000 00000000`73e3d000   php_gd2.dll
ModLoad: 00000000`74350000 00000000`74381000   php_intl.dll
ModLoad: 00000000`4a800000 00000000`4a940000   icuuc49.dll
ModLoad: 00000000`4ad00000 00000000`4be22000   icudt49.dll
ModLoad: 00000000`71310000 00000000`7139e000   MSVCP90.dll
ModLoad: 00000000`02af0000 00000000`02c8f000   icuin49.dll
ModLoad: 00000000`74110000 00000000`7423a000   php_mbstring.dll
ModLoad: 00000000`74480000 00000000`7448c000   php_mysql.dll
ModLoad: 00000000`74300000 00000000`74319000   php_mysqli.dll
ModLoad: 00000000`742d0000 00000000`742f6000   php_oci8_11g.dll
ModLoad: 00000000`02c90000 00000000`02d8b000   OCI.dll 
ModLoad: 00000000`73470000 00000000`7350b000   MSVCR80.dll
ModLoad: 00000000`75540000 00000000`75545000   PSAPI.DLL
ModLoad: 00000000`74320000 00000000`74335000   php_openssl.dll
ModLoad: 00000000`742b0000 00000000`742ba000   php_pdo_mysql.dll
ModLoad: 00000000`73c50000 00000000`73cba000   php_pdo_sqlite.dll
ModLoad: 00000000`740d0000 00000000`7410f000   php_soap.dll
ModLoad: 00000000`742c0000 00000000`742cd000   php_sockets.dll
ModLoad: 00000000`736b0000 00000000`736cc000   IPHLPAPI.DLL
ModLoad: 00000000`736a0000 00000000`736a7000   WINNSI.DLL
ModLoad: 00000000`73ba0000 00000000`73c4a000   php_sqlite3.dll
ModLoad: 00000000`74440000 00000000`7447c000   MSWSOCK.dll
ModLoad: 00000000`74340000 00000000`74346000   WSHIP6.dll
ModLoad: 00000000`74240000 00000000`74245000   WSHTCPIP.dll
ModLoad: 00000000`736e0000 00000000`73707000   WLIDNSP.dll
ModLoad: 00000000`74ed0000 00000000`74f27000   SHLWAPI.dll
ModLoad: 00000000`73690000 00000000`73696000   rasadhlp.dll
ModLoad: 00000000`73650000 00000000`73688000   fwpuclnt.dll
(176c.1b80): Break instruction exception - code 80000003 (first chance)
ntdll!DbgBreakPoint:
00000000`771d0530 cc              int     3
0:004> g
ModLoad: 00000000`70d00000 00000000`70d80000   C:\Windows\SysWOW64\uxtheme.dll
ModLoad: 00000000`70db0000 00000000`70dc3000   C:\Windows\SysWOW64\dwmapi.dll
(176c.1398): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for php5ts.dll - 
php5ts!zval_dtor_func+0x20f:
594f990f 8b043a          mov     eax,dword ptr [edx+edi] ds:002b:6ca70684=????????
0:000:x86> g
(176c.1398): Access violation - code c0000005 (!!! second chance !!!)
ntdll_77360000!ZwRaiseException+0x12:
773815de 83c404          add     esp,4


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-06 11:27 UTC] ab@php.net
Hi,

there should be a .pdb file along with the APC dll in the package. For php you'd also need the corresponding debug pack. Please point the debug tool to these (first screenshot here https://bugs.php.net/bugs-generating-backtrace-win32.php ) and get a trace again. There should be more useful information then and less that symbol not found messages.

Thanks :)
 [2012-11-06 11:30 UTC] ab@php.net
-Assigned To: +Assigned To: ab
 [2012-11-06 14:15 UTC] gopalv@php.net
This looks like the same issue as 

https://bugs.php.net/bug.php?id=63005

can you try the latest svn (or snap?) of APC?
 [2012-11-06 14:25 UTC] stoller at leonex dot de
Hi. I can only use WinDbg as mentioned before. I can give you the call stack with args:

----------------
php5ts!_zval_dtor_func(struct _zval_struct * zvalue = 0x00000023)+0x20f
php5ts!_zval_ptr_dtor(struct _zval_struct ** zval_ptr = 0x00000031)+0x9f
php5ts!_zval_dtor_func(struct _zval_struct * zvalue = 0x0000001c)+0x1c4
php5ts!_zval_ptr_dtor(struct _zval_struct ** zval_ptr = 0x00000031)+0x9f
php_apc!apc_free_class_entry_after_execution(struct _zend_class_entry * src = <Memory access error>, void *** tsrm_ls = <Memory access error>)+0x95
php_apc!apc_deactivate(void *** tsrm_ls = 0x02852f30)+0xe1
php_apc!apc_request_shutdown(void *** tsrm_ls = 0x0126a1c0)+0xa
php_apc!zm_deactivate_apc(int type = 0n19308992, int module_number = 0n19308680, void *** tsrm_ls = 0x0125de78)+0x1b
php5ts!zend_deactivate_modules(void *** tsrm_ls = 0x0126a088)+0x7a
php5ts!zend_deactivate_modules(void *** tsrm_ls = 0x02852f30)+0x41
php5ts!zend_unset_timeout(void *** tsrm_ls = 0x00000000)+0x23
php5ts!php_request_shutdown(void * dummy = 0x00000000)+0xf0
php!php_cli_server_request_shutdown(struct php_cli_server * server = 0x00000254, struct php_cli_server_client * client = 0x0303be10, void *** tsrm_ls = 0x02858928)+0x8
php!php_cli_server_dispatch(struct php_cli_server * server = 0x02851c50, struct php_cli_server_client * client = 0x00000254, void *** tsrm_ls = 0x00000000)+0xf1
php!php_cli_server_recv_event_read_request(struct php_cli_server * server = 0x012fe740, struct php_cli_server_client * client = 0x012f71e0, void *** tsrm_ls = 0x012f72e0)+0xa7
php!php_cli_server_do_event_for_each_fd_callback(void * _params = 0x012fe740, int fd = 0n19886560, int event = 0n19886816)+0x160
php!php_cli_server_poller_iter_on_active(struct php_cli_server_poller * poller = 0x656d616c, void * opaque = <Memory access error>, <function> * callback = <Memory access error>)+0xb4
php!php_cli_server_do_event_loop(struct php_cli_server * server = 0x08088a8b, void *** tsrm_ls = 0x00000000)+0x94
php!do_cli_server(int argc = 0n1473983318, char ** argv = 0x02851c50, void *** tsrm_ls = 0x14245c89)+0x1f5
ntdll_77360000!RtlpLowFragHeapAllocFromContext+0xaec
ntdll_77360000!RtlAllocateHeap+0x206
----------------

I have added the debug symbols to the symbol path of WinDbg. But there's no symbol file for icudt49.dll

Do you need any other information?
 [2012-11-06 20:00 UTC] ab@php.net
-Status: Assigned +Status: Feedback
 [2012-11-06 20:00 UTC] ab@php.net
I've built a snap from the current trunk, please fetch it under http://windows.php.net/downloads/pecl/snaps/apc/3.1.14-dev/ and test again.

The ICU symbols don't matter, the previous bt is nice. There are also .pdb in each package.

I'd also ask you to do two things:

- please test the nts build too, will not work with apache, but with the built-in cli server (or IIS)
- please post your APC ini

Thanks.
 [2012-11-07 09:40 UTC] stoller at leonex dot de
-Status: Feedback +Status: Assigned
 [2012-11-07 09:40 UTC] stoller at leonex dot de
I have tested the dev build. Everything seems to work, now :-)
The NTS Build works, too.

My APC ini:
[APC]
apc.enabled = 1
apc.shm_size = 228M

$ php -i says:

apc

APC Support => disabled
Version => 3.1.14-dev
APC Debugging => Disabled
MMAP Support => Disabled
Locking type => Windows Slim RWLOCK (native)
Serialization Support => broken
Revision => $Revision: 327136 $
Build Date => Nov  6 2012 20:35:35

Directive => Local Value => Master Value
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 228M => 228M
apc.shm_strings_buffer => 4M => 4M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On


But I do not know what "APC Support => disabled" means?!
 [2012-11-07 10:28 UTC] gopalv@php.net
You are missing apc.enable_cli=1.

That's required for APC to be enabled on CLI mode. So the php server would use 
APC, but the CLI mode won't (because it doesn't need to allocate apc.shm_size of 
space for every php script).
 [2012-11-07 10:46 UTC] stoller at leonex dot de
> That's required for APC to be enabled on CLI mode

Hm... that's strange because the exception happened in my PHP built-in server started by CLI. I would think that the exception could not occur with my configuration, but it did?!
 [2012-11-07 10:49 UTC] stoller at leonex dot de
I have tested it with "apc.enable_cli = 1", now, and it works, too ;-)
 [2012-11-07 11:06 UTC] ab@php.net
Happy ending :)
 [2012-11-07 11:06 UTC] ab@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC