[PATCH] +3 for Win32 CoInitalize/CoUninitialize Call Move, Please Apply

From: Date: Fri, 29 Nov 2002 19:39:58 +0000
Subject: [PATCH] +3 for Win32 CoInitalize/CoUninitialize Call Move, Please Apply
Groups: php.dev 
Request: Send a blank email to php-dev+get-91937@lists.php.net to get a copy of this message
We got +3 on applying this but missed it for 4.3.0 RC2. Will someone with the correct karma please apply it to the 4.3.0 tree? Michael --- Michael Sisolak <msisolak@yahoo.com> wrote: > Date: Mon, 25 Nov 2002 10:32:13 -0800 (PST) > From: Michael Sisolak <msisolak@yahoo.com> > Subject: [PATCH 4.3.0] Win32 CoInitalize/CoUninitialize Call Move > To: php-dev@lists.php.net > > While stess testing the recent threading fixes under the ISAPI module > I > was seeing a lot of instability in IIS after the testing finished. > While the PHP pages would continue to load, no ASP pages would > anymore. > I have tracked this down to the placement of the Win32 > CoInitialize() > and CoUninitialize() calls. In the current 4.3.0 release candidate > CoInitialize() and CoUninitialize() are only called once per thread > (from the basic_globals_ctor/_dtor in basic_functions.c). According > to > Microsoft, however, at > http://msdn.microsoft.com/library/en-us/iisref/html/psdk/asp/devs0hm5.asp: > > "COM initialization, from CoInitialize or CoInitializeEx, affects the > thread in which it's called. For this reason, you cannot initialize > COM > unless you uninitialize it before returning from your callback > function. [ . . .] CoInitialize and CoUninitialize need to be called > in > order. If one is called twice in a row, by different ISAPIs on the > same > thread, your users may see error 270." > > This is exactly the error I am seeing: if I load an ASP page in a > thread that has processed PHP pages I get the 270 error (reported as > "Error -2147417842 (0x8001010e)"). I moved the CoInitilize call to > PHP_RINIT_FUNCTION(basic) and CoUninitialize to > PHP_RSHUTDOWN_FUNCTION(basic) and reran my stress testing. After > 100,000 PHP page loads IIS now remains stable and able to process > both > ASP and PHP pages. > > I ran this by Zeev and he suggested that some kind of just-in-time > COM > initialization, but I'm not going to have the time to get to this > full > solution until later. In the meantime for 4.3.0 I request that the > attached patch is applied that moves the CoInitialize or > CoInitializeEx > calls to be per-request. This is the last little fix that all the > multi-threading bug fixing to make the ISAPI rock solid in 4.3.0 > requires. I've done a lot of testing and feel very confident about > including this patch. > > Michael Sisolak > msisolak@yahoo.com __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.dev (#91937) next »