|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-26 00:28 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 01:00:01 2025 UTC |
Description: ------------ I use php as an ISAPI server extension on my self-written web server. Works quite well, except when I remove the extension from memory, i.e., FreeLibrary(hInst) where hInst is the handle to php4isapi.dll. In most cases, this causes the DLL to go belly-up. I traced the problem into the Zend stuff - in zend_shutdown() there's a call to zend_shutdown_timeout_thread() which terminates the timeut thread... or at least it's supposed to do so. Unfortunately, zend_shutdown_timeout_thread() just posts a WM_QUIT message for the thread and then happily goes on deleting thread data... and when the timeout thread finally processes the WM_QUIT message, all data are gone, and it hops to an unused address. Solution to this problem is simple - just make sure that zend_shutdown_timeout_thread() allows the other thread to receive the WM_QUIT message before continuing. I've included a modified version in the "reproduce code" area below which has the desired effect. Reproduce code: --------------- void zend_shutdown_timeout_thread() { if (!timeout_thread_initialized) { return; } PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0); Sleep(0); // <- this does the trick! }