From: p dot desarnaud at wanadoo dot fr Operating system: win32 PHP version: 5CVS-2006-05-23 (snap) PHP Bug Type: Scripting Engine problem Bug description: timeout functionality doesn't work after a second PHP starup on the same thread
Description: ------------ On win32 platform, if I try to startup/shutdown PHP several times during the same thread, after the 2nd startup, the timeout functionality doesn't work, and there is an Windows exception (invalid handle) during the 2nd shutdown. Reproduce code: --------------- // 1° startup php_module_startup(...) .... php_module_shutdown(..) .. // 2° startup/shutdown php_module_startup(...) // from now the function zend_set_timeout() will not work Actual result: -------------- The static variable timeout_thread_initalized declared in the file zend_execute_API.c is not reset to 0 after a shutdown, and so, the next startup will not initialize the timeout thread, and the next shutdown will try to close an invalid handle "CloseHandle(timeout_thread_handle)" inside the function zend_shutdown_timeout_thread(), and I get an exception . The patch to solve the problem : --- fix/zend_execute_API.c 2006-04-21 00:49:20.000000000 +0200 +++ zend_execute_API.c 2006-05-23 09:20:38.953125000 +0200 @@ -1339,6 +1339,7 @@ /* Wait for thread termination */ WaitForSingleObject(timeout_thread_handle, 5000); CloseHandle(timeout_thread_handle); + timeout_thread_initialized=0; } #endif But, is it allowed to startup/shutdown several times during the same thread ??? If yes: there is a bug on Win32... If no: there is no bug.. -- Edit bug report at http://bugs.php.net/?id=37558&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37558&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37558&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37558&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37558&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37558&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37558&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37558&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37558&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37558&r=support Expected behavior: http://bugs.php.net/fix.php?id=37558&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37558&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37558&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37558&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37558&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37558&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37558&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37558&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37558&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37558&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37558&r=mysqlcfg