#35612 [Opn->Fbk]: iis6 Access Violation crash FIX

From: Date: Fri, 09 Dec 2005 11:35:09 +0000
Subject: #35612 [Opn->Fbk]: iis6 Access Violation crash FIX
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90158@lists.php.net to get a copy of this message
 ID:               35612
 Updated by:       tony2001@php.net
 Reported By:      alacn dot uhahaa at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         IIS related
 Operating System: Windows Server 2003
 PHP Version:      5.1.1
 New Comment:

Please provide the patch in unified diff (diff -u).
Thanks.


Previous Comments:
------------------------------------------------------------------------

[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


Thread (18 messages)

« previous php.bugs (#90158) next »