--- Zeev Suraski <[EMAIL PROTECTED]> wrote:
> At 09:53 27/08/2002, Michael Sisolak wrote:
> > > >i've been doing some debugging of the crashes when running php
> under
> > > >the isapi sapi.  is anybody else currently looking at this?  if
> you
> > > >are let's talk - here are my notes so far.
> > >
> > > first off, can you try using
> > > http://www.php.net/~zeev/php-4.2.3rc1.tar.gz
> > > and see if you experience the same problems?  i've made some
> > > thread-safety related fixes there, even though none should lead
> > > to a hard crash...
> >
> >zeev,
> >
> >i believe that i may have tracked down a major isapi filter
> >thread-safety hole.  if i understand  what zend_startup() is doing
> >correctly, it assumes that the thread that it runs under will not
> also
> >be used to serve http requests.
> 
> No, the startup thread can be used as a regular HTTP thread, nothing
> in the 
> code should prevent that.
> The globals code in the startup sequence is very tricky, but it
> should work.

This is a sample of the debug output that I'm seeing (this is PHP 4.2.1
running under Windows 2000 Professional, single CPU):

[1948] the startup thread is 1956
[1948] GLOBAL_FUNCTION_TABLE is 4226120
[1948] in HttpExtensionProc thread 1956, CG(function_table) is 4226120
[1948] in HttpExtensionProc thread 1520, CG(function_table) is 18834536
[1948] in HttpExtensionProc thread 920, CG(function_table) is 18838912
[1948] in HttpExtensionProc thread 1956, CG(function_table) is 4226120
[1948] in HttpExtensionProc thread 1256, CG(function_table) is 19250808
[1948] in HttpExtensionProc thread 920, CG(function_table) is 18838912
[1948] in HttpExtensionProc thread 1956, CG(function_table) is 4226120

Notice that the initial thread (1956) appears to continue to use
GLOBAL_FUNCTION_TABLE as it's own CG(function_table).  I'm reporting
the GLOBAL_FUNCTION_TABLE value from within zend_startup() - is there
some point later in the code that makes it okay that this is the same
value that I get for a CG(function_table) later?

> Either way - starting threads from an ISAPI filter/extension is
> completely 
> forbidden (or at least strongly discouraged) so even if there is some
> bug 
> in there, starting our own thread is not an option.

I don't believe that this is true.  In this sample on MSDN:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q197728

their code for GetExtensionVersion calls AfxBeginThread.  Also in this
document:

http://msdn.microsoft.com/library/en-us/vccore/html/vcconatlserverandcom.asp

point 1 recommends "Create your own thread in GetExtensionVersion on
which you can initialize COM..."

> Can you give me the data I mentioned in the previous letter?

This is PHP 4.2.1 running under Windows 2000 Professional (SP3) on a
single CPU system.  I can't really send the code as I'm currently
testing with a large application that I have been running under CGI. 
I'll see if I can come up with a simpler example that causes the crash,
but the debug output above would be the same either way.  Please let me
know if there is anything else I can provide to help in tracking this
down.


Michael Sisolak
[EMAIL PROTECTED]


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to