|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patcheszend_interned_strings_shutdown_AV (last revision 2013-07-25 17:30 UTC by ericsten@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-25 17:30 UTC] ericsten@php.net
[2013-07-26 10:58 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2013-07-26 10:58 UTC] ab@php.net
[2013-07-26 16:04 UTC] ericsten@php.net
[2013-07-26 16:48 UTC] phpdev at ehrhardt dot nl
[2013-07-26 21:07 UTC] me at laurinkeithdavis dot com
[2013-07-27 01:27 UTC] phpdev at ehrhardt dot nl
[2013-07-27 05:02 UTC] pajoye@php.net
-Assigned To:
+Assigned To: dmitry
[2013-07-27 05:02 UTC] pajoye@php.net
[2013-07-27 08:30 UTC] ab@php.net
[2013-07-27 12:18 UTC] phpdev at ehrhardt dot nl
[2013-07-27 15:25 UTC] ab@php.net
[2013-07-27 16:56 UTC] phpdev at ehrhardt dot nl
[2013-07-29 18:30 UTC] ericsten@php.net
[2013-07-30 07:06 UTC] ab@php.net
[2013-07-30 13:36 UTC] dmitry@php.net
[2013-07-30 13:36 UTC] dmitry@php.net
-Status: Feedback
+Status: Closed
[2013-07-30 13:39 UTC] dmitry@php.net
[2013-07-30 15:13 UTC] phpdev at ehrhardt dot nl
[2013-11-17 09:30 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ If both php_wincache.dll and php_opcache.dll are enabled, and if they are both enabled for CLI, any script leads to an AV at process exit. The call stack indicates that the AV is in zend_interned_strings_dtor, on the following line: free(CG(interned_strings_start)); This is because the value in CG(interned_strings_start) is pointing at the chunk of memory provided by php_wincache.dll for its interned strings. I'm seeing in the debugger that on process startup, the modules are loaded in the order: 1. php_wincache.dll 2. php_opcache.dll And on shutdown, they're terminated in exactly the same order. This causes a problem, because both modules set the CG(interned_strings_start) based upon the value it copied during startup. In this case, php_opcache.dll copied the value that php_wincache.dll set when it started up. So, the last value put back into CG(interned_strings_start) on shutdown was php_wincache's interned strings buffer. php_wincache.dll allocated the interned strings block using (zend's) pemalloc(), but the address for CG(interned_strings_start) is an offset within the allocation, so free() thinks the heap is corrupted. Question: Why are modules terminated in the same order they were initialized? For modules that do 'hooking' of functions or memory, it seems the "unhooking" should happen in reverse order. php.ini settings: zend_extension=php_opcache.dll extension=php_wincache.dll [opcache] opcache.enable=1 opcache.enable_cli=1 [wincache] wincache.enablecli=1 wincache.ocenabled=0 Test script: --------------- <?php $variable = 2.0; function testGlobal() { global $variable; var_dump($variable); } testGlobal(); $variable += 1; testGlobal(); $variable = "Changing to string."; testGlobal(); ?> Expected result: ---------------- No AV on shutdown