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

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.



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

[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

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

------------------------------------------------------------------------

[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-09 19:11:13] [EMAIL PROTECTED]

Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.

------------------------------------------------------------------------

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

Reply via email to