php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27143 ISAPI DLL crashes when unloaded
Submitted: 2004-02-04 07:45 UTC Modified: 2004-04-26 00:28 UTC
From: office at hermannseib dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.4 OS: Win32
Private report: No CVE-ID: None
 [2004-02-04 07:45 UTC] office at hermannseib dot com
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!
}



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-26 00:28 UTC] sniper@php.net
We are aware of PHP's problems with stability under IIS and are working 
to rectify the problem. Unfortunatly your bug report does not contain any
extra useful information and we already have enough bug reports open about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.

There is no ZE2 in PHP 4. Check your version in this report.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 17:00:03 2025 UTC