+1 Anything that impoves stability of isapi at this point is more than welcome. Hopefully bugs.php.net quickfix "isapi instability" will not have to be used as often :)
Edin ----- Original Message ----- From: "Michael Sisolak" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 7:32 PM Subject: [PHP-DEV] [PATCH 4.3.0] Win32 CoInitalize/CoUninitialize Call Move > 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 > [EMAIL PROTECTED] > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com ---------------------------------------------------------------------------- ---- > --- basic_functions.c.orig Fri Nov 08 10:49:32 2002 > +++ basic_functions.c Mon Nov 25 13:25:09 2002 > @@ -959,10 +959,6 @@ > memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state))); > memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex))); > > -#ifdef PHP_WIN32 > - CoInitialize(NULL); > -#endif > - > BG(incomplete_class) = php_create_incomplete_class(TSRMLS_C); > } > > @@ -973,9 +969,6 @@ > if (BG(sm_allowed_env_vars)) { > free(BG(sm_allowed_env_vars)); > } > -#ifdef PHP_WIN32 > - CoUninitialize(); > -#endif > } > > > @@ -1102,6 +1095,10 @@ > > PHP_RINIT_FUNCTION(basic) > { > +#ifdef PHP_WIN32 > + CoInitialize(NULL); > +#endif > + > memset(BG(strtok_table), 0, 256); > BG(strtok_string) = NULL; > BG(strtok_zval) = NULL; > @@ -1182,6 +1179,10 @@ > if (BG(mmap_file)) { > munmap(BG(mmap_file), BG(mmap_len)); > } > +#endif > + > +#ifdef PHP_WIN32 > + CoUninitialize(); > #endif > > return SUCCESS; > > ---------------------------------------------------------------------------- ---- > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php