You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by howard chen <ho...@gmail.com> on 2009/02/11 17:08:08 UTC

[users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Hello,

According to PHP install guide, it said...

------------------------
http://hk.php.net/manual/en/faq.installation.php#faq.installation.apache2

PHP is glue. It is the glue used to build cool web applications by
sticking dozens of 3rd-party libraries together and making it all
appear as one coherent entity through an intuitive and easy to learn
language interface. The flexibility and power of PHP relies on the
stability and robustness of the underlying platform. It needs a
working OS, a working web server and working 3rd-party libraries to
glue together. When any of these stop working PHP needs ways to
identify the problems and fix them quickly. When you make the
underlying framework more complex by not having completely separate
execution threads, completely separate memory segments and a strong
sandbox for each request to play in, feet of clay are introduced into
PHP's system....
------------------------

But I just wonder, isn't all mod_php/mod_python/mod_perl/mod_ruby are
relying on the same set of popular 3rd party libraries? e.g. zlib,
libxml, expat, iconv....so the above statement is also true in
mod_python/mod_perl/mod_ruby?

So it turn out that Threaded MPM is only suitable for serving static pages?

Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by Nick Kew <ni...@webthing.com>.
On Thu, 12 Feb 2009 00:08:08 +0800
howard chen <ho...@gmail.com> wrote:

> But I just wonder, isn't all mod_php/mod_python/mod_perl/mod_ruby are
> relying on the same set of popular 3rd party libraries? e.g. zlib,
> libxml, expat, iconv....so the above statement is also true in
> mod_python/mod_perl/mod_ruby?

There are relatively few libraries that are positively not thread-safe
(some elderly graphics stuff like libjpeg springs to mind).

However, there are many libraries that can be made non-thread-safe
by sloppy programming in applications that use them.  I think they
must've fixed it by now, but PHP+libxml2 a few years ago was
notoriously *much* worse than just non-thread-safe: it could foul
up *any* non-PHP application that uses the lib, by *globally*
installing its own error handlers.  So, other module hits a parse
error, php's handler gets invoked but is uninitialised - SEGFAULT!

> So it turn out that Threaded MPM is only suitable for serving static
> pages?

Nope.  Plenty of dynamic apps work with threaded MPMs.  With or
without perl/python/ruby/whatever.


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by "Anthony J. Biacco" <ab...@formatdynamics.com>.
It can pretty much be said about anything that uses libraries that are
not thread-safe, yes. While things like mod_perl are thread safe with
ithreads as far as apache is concerned, mod_perl won't guarantee the
thread-safeness of talking to the libraries, nor will any other mod_*
probably that uses that library. You have to check yourself which
libraries are ok, and which are not when you decide whether you can go
with the worker mpm or not. Or, in my case, with php I went with the
mod_fastcgi and the fcgi version of php. I simply don't have a whole lot
of php requests. But YMMV.

-Tony
---------------------------
Manager, IT Operations
Format Dynamics, Inc.
303-573-1800x27
abiacco@formatdynamics.com
http://www.formatdynamics.com

-----Original Message-----
From: howard chen [mailto:howachen@gmail.com] 
Sent: Wednesday, February 11, 2009 9:08 AM
To: users@httpd.apache.org
Subject: [users@httpd] Threaded MPM +
mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Hello,

According to PHP install guide, it said...

------------------------
http://hk.php.net/manual/en/faq.installation.php#faq.installation.apache
2

PHP is glue. It is the glue used to build cool web applications by
sticking dozens of 3rd-party libraries together and making it all
appear as one coherent entity through an intuitive and easy to learn
language interface. The flexibility and power of PHP relies on the
stability and robustness of the underlying platform. It needs a
working OS, a working web server and working 3rd-party libraries to
glue together. When any of these stop working PHP needs ways to
identify the problems and fix them quickly. When you make the
underlying framework more complex by not having completely separate
execution threads, completely separate memory segments and a strong
sandbox for each request to play in, feet of clay are introduced into
PHP's system....
------------------------

But I just wonder, isn't all mod_php/mod_python/mod_perl/mod_ruby are
relying on the same set of popular 3rd party libraries? e.g. zlib,
libxml, expat, iconv....so the above statement is also true in
mod_python/mod_perl/mod_ruby?

So it turn out that Threaded MPM is only suitable for serving static
pages?

Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
howard chen wrote:
> On Thu, Feb 12, 2009 at 12:34 AM, Eric Covener <co...@gmail.com> wrote:
> 
>> Bizarre conclusion.  Other interpreters are likely more
>> thread-aware/thread-exploitative when not embedded in Apache, so
>> they'd be less likely to casually link with non-threadsafe libraries.
>>
> 
> Why? Since if mod_php has thread safety problem with Apache2 worker
> MPM, mod_python/mod_ruby should also have these problem, isn't?
> 
> Othwsie, it is the PHP team over  worry about the problem?

Agreed.  This is the standard PHP team FUD that they don't grok threading
and don't have the capacity to determine which libraries are thread safe
(and under what conditions).

It's 2009, so I don't expect this to change before PHP ceases to be
relevant.

FWIW, in most applications it's thread safety is just fine.  But this
can't be said if Apache ever becomes free-threaded, as opposed to just
threaded on a dedicated worker - too many cases where TLS is used in
the various libs that rely on a task not jumping threads.  There's also
little guarantee that multiple PHP interpreters can exist on a thread,
e.g. if the filter + handler are both used.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by Eric Covener <co...@gmail.com>.
On Thu, Feb 12, 2009 at 10:02 AM, howard chen <ho...@gmail.com> wrote:
> On Thu, Feb 12, 2009 at 12:34 AM, Eric Covener <co...@gmail.com> wrote:
>
>> Bizarre conclusion.  Other interpreters are likely more
>> thread-aware/thread-exploitative when not embedded in Apache, so
>> they'd be less likely to casually link with non-threadsafe libraries.
>>
>
> Why? Since if mod_php has thread safety problem with Apache2 worker
> MPM, mod_python/mod_ruby should also have these problem, isn't?

They're different code with different build systems.   I don't think
it immediately follows that they'd all have thread-safety problems.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> On Thu, Feb 12, 2009 at 12:34 AM, Eric Covener <co...@gmail.com> wrote:
> > Bizarre conclusion.  Other interpreters are likely more
> > thread-aware/thread-exploitative when not embedded in Apache, so
> > they'd be less likely to casually link with non-threadsafe libraries.

On 12.02.09 23:02, howard chen wrote:
> Why? Since if mod_php has thread safety problem with Apache2 worker
> MPM, mod_python/mod_ruby should also have these problem, isn't?

Only if they use the same non-thread-safe libraries.

such codes can have internal ways for avoiding such problems but I doubt any
does, it's pita to code such thing.

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by howard chen <ho...@gmail.com>.
On Thu, Feb 12, 2009 at 12:34 AM, Eric Covener <co...@gmail.com> wrote:

> Bizarre conclusion.  Other interpreters are likely more
> thread-aware/thread-exploitative when not embedded in Apache, so
> they'd be less likely to casually link with non-threadsafe libraries.
>

Why? Since if mod_php has thread safety problem with Apache2 worker
MPM, mod_python/mod_ruby should also have these problem, isn't?

Othwsie, it is the PHP team over  worry about the problem?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Threaded MPM + mod_php/mod_python/mod_perl/mod_ruby.. thread safe?

Posted by Eric Covener <co...@gmail.com>.
On Wed, Feb 11, 2009 at 11:08 AM, howard chen <ho...@gmail.com> wrote:
> But I just wonder, isn't all mod_php/mod_python/mod_perl/mod_ruby are
> relying on the same set of popular 3rd party libraries? e.g. zlib,
> libxml, expat, iconv....so the above statement is also true in
> mod_python/mod_perl/mod_ruby?
>
> So it turn out that Threaded MPM is only suitable for serving static pages?

Bizarre conclusion.  Other interpreters are likely more
thread-aware/thread-exploitative when not embedded in Apache, so
they'd be less likely to casually link with non-threadsafe libraries.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org