#35612 [NEW]: iis6 Access Violation crash FIX

From: Date: Fri, 09 Dec 2005 11:29:43 +0000
Subject: #35612 [NEW]: iis6 Access Violation crash FIX
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90157@lists.php.net to get a copy of this message
From:             alacn dot uhahaa at gmail dot com
Operating system: Windows Server 2003
PHP version:      5.1.1
PHP Bug Type:     IIS related
Bug description:  iis6 Access Violation crash FIX

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 bug report at http://bugs.php.net/?id=35612&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35612&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35612&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35612&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35612&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35612&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35612&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35612&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35612&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35612&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35612&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35612&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35612&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35612&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35612&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35612&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35612&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35612&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35612&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35612&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35612&r=mysqlcfg


Thread (18 messages)

« previous php.bugs (#90157) next »