From:             office at hermannseib dot com
Operating system: Win32
PHP version:      4.3.4
PHP Bug Type:     Zend Engine 2 problem
Bug description:  ISAPI DLL crashes when unloaded

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!
}



-- 
Edit bug report at http://bugs.php.net/?id=27143&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27143&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27143&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27143&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27143&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27143&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27143&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27143&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27143&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27143&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27143&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27143&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27143&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27143&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27143&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27143&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27143&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27143&r=float

Reply via email to