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

2005-12-21 Thread alacn dot uhahaa at gmail dot com
 ID:   35612
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: IIS related
 Operating System: Windows Server 2003
 PHP Version:  5CVS-2005-12-20 (snap)
 Assigned To:  dmitry
 New Comment:

ok, i have tested it on iis5 (windows xp) and iis6 (windows 2003), both
is configured to use the extension php5isapi.dll.

we use WaitForSingleObject to wait the thread finish:
- it will return WAIT_OBJECT_0 when the thread finish,
- or return WAIT_TIMEOUT if the thread didnt finish before the time
elapse

the thing is, it should result WAIT_OBJECT_0 meaning that the thread
was ended fine.

lets debug it, set WITH_ALACN_PATCH to 0 to use current code; or set it
to 1 to use fixed code

everyone user need have full access on the c:\temp\ otherwise it
can fail create the file.


on the file c:\temp\php_debug.log:

-- means its fine
WaitForSingleObject:
it returned WAIT_OBJECT_0! thread was ended.

-- means that we didnt wait the thread finish
WaitForSingleObject:
it returned WAIT_TIMEOUT! thread may still running!.

-- deadlocked after WaitForSingleObject, process killed!
WaitForSingleObject:




--- php5.1-200512211530_zend_execute_API.c  Tue Dec 20 09:30:10 2005
+++ php5.1-200512211530_debug_zend_execute_API.cWed Dec 21 15:52:46
2005
@@ -1256,6 +1256,26 @@
 }
 
 
+void save_debug_msg(char *sz)
+{
+   HANDLE h;
+   int i;
+   DWORD dwRW;
+
+   h = CreateFile(c:\\temp\\php_debug.log, GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
0);
+   if(h == INVALID_HANDLE_VALUE) return;
+
+   SetFilePointer(h, 0, 0, 2);
+
+   i = strlen(sz);
+   WriteFile(h, sz, i, dwRW, 0);
+
+   CloseHandle(h);
+}
+
+// change this!!
+#define WITH_ALACN_PATCH   1
+
 
 static unsigned __stdcall timeout_thread_proc(void *pArgs)
 {
@@ -1284,6 +1304,9 @@
}
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
+#if WITH_ALACN_PATCH
+   SetEvent(timeout_thread_handle);
+#endif
return 0;
 }
 
@@ -1291,20 +1314,42 @@
 void zend_init_timeout_thread()
 {
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
+#if WITH_ALACN_PATCH
+   timeout_thread_handle = CreateEvent(0, 0, 0, 0);
+   _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0,
timeout_thread_id);
+#else
timeout_thread_handle = _beginthreadex(NULL, 0, timeout_thread_proc,
NULL, 0, timeout_thread_id);
+#endif
WaitForSingleObject(timeout_thread_event, INFINITE);
 }
 
 
 void zend_shutdown_timeout_thread()
 {
+   DWORD dw;
+
if (!timeout_thread_initialized) {
return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
 
+   save_debug_msg(WaitForSingleObject:\r\n);
+
/* Wait for thread termination */
-   WaitForSingleObject(timeout_thread_handle, 5000);
+   dw = WaitForSingleObject(timeout_thread_handle, INFINITE);
+   switch(dw)
+   {
+   case WAIT_OBJECT_0:
+   save_debug_msg(it returned WAIT_OBJECT_0! thread was 
ended.\r\n);
+   break;
+   case WAIT_TIMEOUT:
+   save_debug_msg(it returned WAIT_TIMEOUT! thread may still
running!.\r\n);
+   break;
+   default:
+   save_debug_msg(unknow return.\n);
+   break;
+   }
+
CloseHandle(timeout_thread_handle);
 }


Previous Comments:


[2005-12-21 11:09:24] [EMAIL PROTECTED]

alacn, could you please explain why WaitForSingleObject() may not work
on thread handle? (it works fine for me).
Is it IIS6 specific behavior?

Also I didn't understand, why you need 30 sec timeout?
The tmeout thread is event based and it never locks. It should quit
right after it gets WM_QUIT.




[2005-12-21 08:11:27] vaguener at hotmail dot com

thats right,

when i set the wait time to INFINITE in the current code
WaitForSingleObject(timeout_thread_handle, INFINITE);
it never close the worker process.

but on alacn's code it do.
WaitForSingleObject(timeout_thread_finish, INFINITE);



[2005-12-20 12:43:55] [EMAIL PROTECTED]

Dmitry, can you check this out please.



[2005-12-20 12:38:23] alacn dot uhahaa at gmail dot com

ok.. here is udiff for latest cvs (php5.1)

what is happenning is that since the thread that created the timeout
thread have different access levels than the one that will wait it
finish, waitforsingleobject on timeout thread handle wont work right,
it will always timeout, and access violation will occur

expected: it should return before the timeout, that way wont occur
access violation

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

2005-12-20 Thread alacn dot uhahaa at gmail dot com
 ID:   35612
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: IIS related
 Operating System: Windows Server 2003
 PHP Version:  5.1.1
 Assigned To:  dmitry
 New Comment:

ok.. here is udiff for latest cvs (php5.1)

what is happenning is that since the thread that created the timeout
thread have different access levels than the one that will wait it
finish, waitforsingleobject on timeout thread handle wont work right,
it will always timeout, and access violation will occur

expected: it should return before the timeout, that way wont occur
access violation

the fix: it should wait at least 30 secs, waitforsingleobject will
never elapse all the 30 secs, unless in a bad error,
- it will always return before the 30 secs, as it should -


btw ...cant php4 be fixed too? :(


--- php5.1-200512200930_zend_execute_API.c  Fri Dec 16 21:30:06 2005
+++ php5.1-200512200930_fixed_zend_execute_API.cTue Dec 20 08:44:24
2005
@@ -46,7 +46,7 @@
 static WNDCLASS wc;
 static HWND timeout_window;
 static HANDLE timeout_thread_event;
-static HANDLE timeout_thread_handle;
+static HANDLE timeout_thread_finish;
 static DWORD timeout_thread_id;
 static int timeout_thread_initialized=0;
 #endif
@@ -1282,6 +1282,7 @@
}
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
+   SetEvent(timeout_thread_finish);
return 0;
 }
 
@@ -1289,7 +1290,8 @@
 void zend_init_timeout_thread()
 {
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
-   timeout_thread_handle = _beginthreadex(NULL, 0, timeout_thread_proc,
NULL, 0, timeout_thread_id);
+   timeout_thread_finish = CreateEvent(0, 0, 0, 0);
+   _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0,
timeout_thread_id);
WaitForSingleObject(timeout_thread_event, INFINITE);
 }
 
@@ -1302,8 +1304,7 @@
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
 
/* Wait for thread termination */
-   WaitForSingleObject(timeout_thread_handle, 5000);
-   CloseHandle(timeout_thread_handle);
+   WaitForSingleObject(timeout_thread_finish, 3);
 }
 
 #endif


Previous Comments:


[2005-12-19 08:51:01] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

And this time, really make sure you have the right PHP installed. Only
way to be sure is to delete ALL old dlls related to PHP. Especially
from C:\windows\ directory.
Also, make any patches against the latest CVS sources. PHP 4 is too
old.



[2005-12-13 11:15:11] alacn dot uhahaa at gmail dot com

its not fixed in cvs (php5.1-200512130930)

udiff for php4:

--- php4.4.1_zend_execute_API.c Tue Aug 02 14:52:34 2005
+++ php4.4.1_fixed_zend_execute_API.c   Tue Dec 13 08:11:36 2005
@@ -52,6 +52,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
 
 
@@ -813,6 +814,9 @@
}
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
+
+   SetEvent(timeout_thread_finish_event); // alacn
+
return 0;
 }
 
@@ -820,6 +824,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);
 }
@@ -831,6 +836,8 @@
return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
+
+   WaitForSingleObject(timeout_thread_finish_event, 3); // alacn
 }
 
 #endif



[2005-12-13 09:13:43] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip





[2005-12-12 19:46:58] [EMAIL PROTECTED]

Reassigned to Dmitry.



[2005-12-12 19:17:26] alacn dot uhahaa at gmail dot com

at cvs its:
timeout_thread_handle = _beginthreadex(..);
and
WaitForSingleObject(timeout_thread_handle, 5000);

but this wont work right, because the thread that created the
timeout_thread is not the same that will wait it finish, so, if you
check, WaitForSingleObject will always result WAIT_OBJECT_TIMEOUT
instead of WAIT_OBJECT_0

thats why it should wait using an event object instead of thread

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

2005-12-13 Thread alacn dot uhahaa at gmail dot com
 ID:   35612
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: IIS related
 Operating System: Windows Server 2003
 PHP Version:  5.1.1
 Assigned To:  dmitry
 New Comment:

its not fixed in cvs (php5.1-200512130930)

udiff for php4:

--- php4.4.1_zend_execute_API.c Tue Aug 02 14:52:34 2005
+++ php4.4.1_fixed_zend_execute_API.c   Tue Dec 13 08:11:36 2005
@@ -52,6 +52,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
 
 
@@ -813,6 +814,9 @@
}
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);
+
+   SetEvent(timeout_thread_finish_event); // alacn
+
return 0;
 }
 
@@ -820,6 +824,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);
 }
@@ -831,6 +836,8 @@
return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
+
+   WaitForSingleObject(timeout_thread_finish_event, 3); // alacn
 }
 
 #endif


Previous Comments:


[2005-12-13 09:13:43] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip





[2005-12-12 19:46:58] [EMAIL PROTECTED]

Reassigned to Dmitry.



[2005-12-12 19:17:26] alacn dot uhahaa at gmail dot com

at cvs its:
timeout_thread_handle = _beginthreadex(..);
and
WaitForSingleObject(timeout_thread_handle, 5000);

but this wont work right, because the thread that created the
timeout_thread is not the same that will wait it finish, so, if you
check, WaitForSingleObject will always result WAIT_OBJECT_TIMEOUT
instead of WAIT_OBJECT_0

thats why it should wait using an event object instead of thread
handle

also, it should be at least 30 secs, because 5 secs is not enough, with
an event object (instead of thread handle), it will finish before the 30
secs as it should be




--- 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, 3); // alacn
 }
 
 #endif



[2005-12-09 19:11:13] [EMAIL PROTECTED]

Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.



[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

#35612 [Csd-Opn]: [PATCH] iis6 Access Violation crash

2005-12-12 Thread alacn dot uhahaa at gmail dot com
 ID:   35612
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Closed
+Status:   Open
 Bug Type: IIS related
 Operating System: Windows Server 2003
 PHP Version:  5.1.1
 Assigned To:  dmitry
 New Comment:

at cvs its:
timeout_thread_handle = _beginthreadex(..);
and
WaitForSingleObject(timeout_thread_handle, 5000);

but this wont work right, because the thread that created the
timeout_thread is not the same that will wait it finish, so, if you
check, WaitForSingleObject will always result WAIT_OBJECT_TIMEOUT
instead of WAIT_OBJECT_0

thats why it should wait using an event object instead of thread
handle

also, it should be at least 30 secs, because 5 secs is not enough, with
an event object (instead of thread handle), it will finish before the 30
secs as it should be




--- 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, 3); // alacn
 }
 
 #endif


Previous Comments:


[2005-12-09 19:11:13] [EMAIL PROTECTED]

Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.



[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, 3); // 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

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

2005-12-09 Thread alacn dot uhahaa at gmail dot com
 ID:   35612
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: IIS related
 Operating System: Windows Server 2003
 PHP Version:  5.1.1
 New Comment:

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, 3); // alacn
 }
 
 #endif


Previous Comments:


[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, 3);
}






-- 
Edit this bug report at http://bugs.php.net/?id=35612edit=1


#35298 [NoF-Opn]: Access Violation Crash IIS 6

2005-12-04 Thread alacn dot uhahaa at gmail dot com
 ID:   35298
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   No Feedback
+Status:   Open
 Bug Type: Reproducible crash
 Operating System: Windows 2003
 PHP Version:  4.4.1
 New Comment:

its not fixed on cvs yet, it happens both on php 4.4.1 and php5
series.

it happens when iis is recycling the process, iis tell php that it will
free the library, php perform cleanup tasks and return, but, if zend
timeout thread is running while this happens and php return before zend
timeout thread end, it will crash, because the timeout thread will
execute on a freed (unloaded) place.

this is causing zend window timeout error on windows 2003
(for both php5 and php4)


Previous Comments:


[2005-11-28 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2005-11-20 22:20:23] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip





[2005-11-20 20:08:24] alacn dot uhahaa at gmail dot com

yah, i think its fixed now,

at zend_execute_API.c

[...]

static WNDCLASS wc;
static HWND timeout_window;
static HANDLE timeout_thread_event;
static DWORD timeout_thread_id;
static int timeout_thread_initialized=0;

static HANDLE timeout_thread_finish_event; //added

[...]

static unsigned __stdcall timeout_thread_proc(void *pArgs)
{
[...]
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);

SetEvent(timeout_thread_finish_event); //added

return 0;
}


void zend_init_timeout_thread()
{
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);

timeout_thread_finish_event = CreateEvent(0, 0, 0, 0); //added

_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0,
timeout_thread_id);
WaitForSingleObject(timeout_thread_event, INFINITE);
}


void zend_shutdown_timeout_thread()
{
if (!timeout_thread_initialized) {
  return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);

WaitForSingleObject(timeout_thread_finish_event, 3); //added
}



[2005-11-20 19:45:39] alacn dot uhahaa at gmail dot com

i think that it could be fixed with WaitForSingleObject, making it wait
a bit of time to the timeout thread end.



[2005-11-20 19:40:01] alacn dot uhahaa at gmail dot com

the problem is at zend_execute_API.c

the access violation happens when it free the library before
timeout_thread_proc() finish,

at zend_shutdown_timeout_thread()
after PostThreadMessage it should wait some time to the
timeout_thread_proc() finish.

if it dont wait, the timeout_thread_proc() will walk in NULL bytes
because the code was released by the IIS



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35298

-- 
Edit this bug report at http://bugs.php.net/?id=35298edit=1


#35298 [Bgs]: Access Violation Crash IIS 6

2005-11-20 Thread alacn dot uhahaa at gmail dot com
 ID:   35298
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
 Status:   Bogus
 Bug Type: Reproducible crash
 Operating System: Windows 2003
 PHP Version:  4.4.1
 New Comment:

the problem is at zend_execute_API.c

the access violation happens when it free the library before
timeout_thread_proc() finish,

at zend_shutdown_timeout_thread()
after PostThreadMessage it should wait some time to the
timeout_thread_proc() finish.

if it dont wait, the timeout_thread_proc() will walk in NULL bytes
because the code was released by the IIS


Previous Comments:


[2005-11-19 22:24:48] [EMAIL PROTECTED]

We are aware of PHP's problems with stability under IIS and are working

to rectify the problem. Unfortunatly your bug report does not contain
any
extra useful information and we already have enough bug reports open
about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.





[2005-11-19 22:19:18] alacn dot uhahaa at gmail dot com

Description:

while recycling iis6 worker process when an user is uploading a file,
php crash with access violation zend timeout window: w3wp - read error
at address 0x019052a5

Reproduce code:
---
at php.ini
post_max_size = 1032M
upload_max_filesize = 1024M

while an user is uploading a file (post, upload form) (use a big file,
so it wont end before we finish), open iis mmc, go to application
pools, select the php pool (DefaultAppPool if you didnt change it),
right click on it and recycle

im using Windows 2003, IIS6, php 4.4.1 isapi

Expected result:

it should recycle without crash

Actual result:
--
php crash with access violation
zend timeout window: w3wp
read error at address 0x019052a5






-- 
Edit this bug report at http://bugs.php.net/?id=35298edit=1


#35298 [Bgs-Opn]: Access Violation Crash IIS 6

2005-11-20 Thread alacn dot uhahaa at gmail dot com
 ID:   35298
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Reproducible crash
 Operating System: Windows 2003
 PHP Version:  4.4.1
 New Comment:

i think that it could be fixed with WaitForSingleObject, making it wait
a bit of time to the timeout thread end.


Previous Comments:


[2005-11-20 19:40:01] alacn dot uhahaa at gmail dot com

the problem is at zend_execute_API.c

the access violation happens when it free the library before
timeout_thread_proc() finish,

at zend_shutdown_timeout_thread()
after PostThreadMessage it should wait some time to the
timeout_thread_proc() finish.

if it dont wait, the timeout_thread_proc() will walk in NULL bytes
because the code was released by the IIS



[2005-11-19 22:24:48] [EMAIL PROTECTED]

We are aware of PHP's problems with stability under IIS and are working

to rectify the problem. Unfortunatly your bug report does not contain
any
extra useful information and we already have enough bug reports open
about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.





[2005-11-19 22:19:18] alacn dot uhahaa at gmail dot com

Description:

while recycling iis6 worker process when an user is uploading a file,
php crash with access violation zend timeout window: w3wp - read error
at address 0x019052a5

Reproduce code:
---
at php.ini
post_max_size = 1032M
upload_max_filesize = 1024M

while an user is uploading a file (post, upload form) (use a big file,
so it wont end before we finish), open iis mmc, go to application
pools, select the php pool (DefaultAppPool if you didnt change it),
right click on it and recycle

im using Windows 2003, IIS6, php 4.4.1 isapi

Expected result:

it should recycle without crash

Actual result:
--
php crash with access violation
zend timeout window: w3wp
read error at address 0x019052a5






-- 
Edit this bug report at http://bugs.php.net/?id=35298edit=1


#35298 [Opn]: Access Violation Crash IIS 6

2005-11-20 Thread alacn dot uhahaa at gmail dot com
 ID:   35298
 User updated by:  alacn dot uhahaa at gmail dot com
 Reported By:  alacn dot uhahaa at gmail dot com
 Status:   Open
 Bug Type: Reproducible crash
 Operating System: Windows 2003
 PHP Version:  4.4.1
 New Comment:

yah, i think its fixed now,

at zend_execute_API.c

[...]

static WNDCLASS wc;
static HWND timeout_window;
static HANDLE timeout_thread_event;
static DWORD timeout_thread_id;
static int timeout_thread_initialized=0;

static HANDLE timeout_thread_finish_event; //added

[...]

static unsigned __stdcall timeout_thread_proc(void *pArgs)
{
[...]
DestroyWindow(timeout_window);
UnregisterClass(wc.lpszClassName, NULL);

SetEvent(timeout_thread_finish_event); //added

return 0;
}


void zend_init_timeout_thread()
{
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);

timeout_thread_finish_event = CreateEvent(0, 0, 0, 0); //added

_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0,
timeout_thread_id);
WaitForSingleObject(timeout_thread_event, INFINITE);
}


void zend_shutdown_timeout_thread()
{
if (!timeout_thread_initialized) {
  return;
}
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);

WaitForSingleObject(timeout_thread_finish_event, 3); //added
}


Previous Comments:


[2005-11-20 19:45:39] alacn dot uhahaa at gmail dot com

i think that it could be fixed with WaitForSingleObject, making it wait
a bit of time to the timeout thread end.



[2005-11-20 19:40:01] alacn dot uhahaa at gmail dot com

the problem is at zend_execute_API.c

the access violation happens when it free the library before
timeout_thread_proc() finish,

at zend_shutdown_timeout_thread()
after PostThreadMessage it should wait some time to the
timeout_thread_proc() finish.

if it dont wait, the timeout_thread_proc() will walk in NULL bytes
because the code was released by the IIS



[2005-11-19 22:24:48] [EMAIL PROTECTED]

We are aware of PHP's problems with stability under IIS and are working

to rectify the problem. Unfortunatly your bug report does not contain
any
extra useful information and we already have enough bug reports open
about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.





[2005-11-19 22:19:18] alacn dot uhahaa at gmail dot com

Description:

while recycling iis6 worker process when an user is uploading a file,
php crash with access violation zend timeout window: w3wp - read error
at address 0x019052a5

Reproduce code:
---
at php.ini
post_max_size = 1032M
upload_max_filesize = 1024M

while an user is uploading a file (post, upload form) (use a big file,
so it wont end before we finish), open iis mmc, go to application
pools, select the php pool (DefaultAppPool if you didnt change it),
right click on it and recycle

im using Windows 2003, IIS6, php 4.4.1 isapi

Expected result:

it should recycle without crash

Actual result:
--
php crash with access violation
zend timeout window: w3wp
read error at address 0x019052a5






-- 
Edit this bug report at http://bugs.php.net/?id=35298edit=1


#35298 [NEW]: Access Violation Crash IIS 6

2005-11-19 Thread alacn dot uhahaa at gmail dot com
From: alacn dot uhahaa at gmail dot com
Operating system: Windows 2003
PHP version:  4.4.1
PHP Bug Type: Reproducible crash
Bug description:  Access Violation Crash IIS 6

Description:

while recycling iis6 worker process when an user is uploading a file, php
crash with access violation zend timeout window: w3wp - read error at
address 0x019052a5

Reproduce code:
---
at php.ini
post_max_size = 1032M
upload_max_filesize = 1024M

while an user is uploading a file (post, upload form) (use a big file, so
it wont end before we finish), open iis mmc, go to application pools,
select the php pool (DefaultAppPool if you didnt change it), right click
on it and recycle

im using Windows 2003, IIS6, php 4.4.1 isapi

Expected result:

it should recycle without crash

Actual result:
--
php crash with access violation
zend timeout window: w3wp
read error at address 0x019052a5


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