ID: 35612
Updated by: [EMAIL PROTECTED]
Reported By: alacn dot uhahaa at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: IIS related
Operating System: Windows Server 2003
PHP Version: 5.1.1
-Assigned To:
+Assigned To: dmitry
Previous Comments:
------------------------------------------------------------------------
[2005-12-09 13:45:22] alacn dot uhahaa at gmail dot com
note that this happens for both php5 and php4
--- php5.1.1_zend_execute_API.c Thu Nov 24 09:33:12 2005
+++ php5.1.1_fixed_zend_execute_API.c Fri Dec 09 10:38:58 2005
@@ -48,6 +48,7 @@
static HANDLE timeout_thread_event;
static DWORD timeout_thread_id;
static int timeout_thread_initialized=0;
+static HANDLE timeout_thread_finish_event; // alacn
#endif
#if ZEND_DEBUG
@@ -1255,6 +1256,9 @@
}
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
+
+ SetEvent(timeout_thread_finish_event); // alacn
+
return 0;
}
@@ -1262,6 +1266,7 @@
void zend_init_timeout_thread()
{
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
+ timeout_thread_finish_event = CreateEvent(0, 0, 0, 0); // alacn
_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0,
&timeout_thread_id);
WaitForSingleObject(timeout_thread_event, INFINITE);
}
@@ -1273,6 +1278,8 @@
return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
+
+ WaitForSingleObject(timeout_thread_finish_event, 30000); // alacn
}
#endif
------------------------------------------------------------------------
[2005-12-09 12:35:08] [EMAIL PROTECTED]
Please provide the patch in unified diff (diff -u).
Thanks.
------------------------------------------------------------------------
[2005-12-09 12:29:41] alacn dot uhahaa at gmail dot com
Description:
------------
PHP5 and PHP4 on iis6 (windows server 2003) sometimes crash with access
violation
Reproduce code:
---------------
(code at zend_execute_API.c)
before iis shutdown or recycle the pool, it will call
"zend_shutdown_timeout_thread()", that will post a quit message on
"timeout_thread_id" and return
Expected result:
----------------
"zend_shutdown_timeout_thread()" should wait "timeout_thread" finish
before return
Actual result:
--------------
sometimes "zend_shutdown_timeout_thread()" return before the
"tiumeout_thread" finish, and the iis release the library, than the iis
crash at "timeout_thread_proc()" because the library was released.
the fix for PHP5 and PHP4 at "zend_execute_API.c"
"[...]" means hidden code...
#ifdef ZEND_WIN32
#include <process.h>
/* true global */
[...]
// add next line
static HANDLE timeout_thread_finish_event;
#endif
[...]
static unsigned __stdcall timeout_thread_proc(void *pArgs)
{
[...]
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
// add next line
SetEvent(timeout_thread_finish_event);
return 0;
}
void zend_init_timeout_thread()
{
timeout_thread_event = CreateEvent([..]);
// add next line
timeout_thread_finish_event = CreateEvent(0, 0, 0, 0);
[...]
}
void zend_shutdown_timeout_thread()
{
[...]
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
// add next line
WaitForSingleObject(timeout_thread_finish_event, 30000);
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35612&edit=1