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

From: Date: Tue, 13 Dec 2005 08:13:44 +0000
Subject: #35612 [Asn->Fbk]: [PATCH] iis6 Access Violation crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90331@lists.php.net to get a copy of this message
 ID:               35612
 Updated by:       sniper@php.net
 Reported By:      alacn dot uhahaa at gmail dot com
-Status:           Assigned
+Status:           Feedback
 Bug Type:         IIS related
 Operating System: Windows Server 2003
 PHP Version:      5.1.1
 Assigned To:      dmitry
 New Comment:

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




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

[2005-12-12 19:46:58] tony2001@php.net

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

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

[2005-12-09 19:11:13] dmitry@php.net

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

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

[2005-12-09 12:35:08] tony2001@php.net

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

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

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


Thread (18 messages)

« previous php.bugs (#90331) next »