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.c Tue 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, 30000);
}
#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, 30000); // 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
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, 30000); // alacn
}
#endif
------------------------------------------------------------------------
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/35612
--
Edit this bug report at http://bugs.php.net/?id=35612&edit=1