httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Eisengarten" <>
Subject AW: apache-php and pthread
Date Wed, 29 Nov 2000 20:23:22 GMT

-----Ursprungliche Nachricht-----
Von: []
Gesendet: Mittwoch, 29. November 2000 19:20
Betreff: Re: apache-php and pthread

Hello Thomas...

In a message dated 00-11-29 10:42:14 EST, Thomas Eisengarten writes...

> hello,
>  i've searched the internet but i don't find any hints about my problem -
>  i write to this list.
>  i write an extension for php wich dynamicaly loads an .so. this .so
>  some pthreds which communicate with an other server. the creation of the
>  thread does not work and the apache hangs. if i use php as a standalone
>  executable it works fine. do i need any special attributes or somthing
>  to create a thread using pthreads in combination with apache?!
>  thanx
>  thomas eisengarten

Since you say 'if I use php as a standalone executable it works fine'
then I am assuming the following...

1. You have written a separate module for Apache that registers
itself to participate in the 'php-script' handler chain OR has
registered itself to kick-in for .php, .php3, etc. PHP file
extensions or the PHP mime type. ( x-application-whatever ).

2. If you do NOT load mod_php and your ScriptAlias or Action
setup is pointing to a properly installed external copy of the
PHP CGI executables... then your module is able to launch
it's threads OK.

3. If you use "LoadModule" and mod_php... the same thread
launching fails (OR) if you compile mod_php into the core, Ditto.
( Which is it? You failed to say exactly how you are using
mod_php itself.. external DSO or built into the core? )

> do i need any special attributes or somthing else
> to create a thread using pthreads in combination with apache?

Not especially, but you do need to be sure you have the
stack space you need. Don't forget that when it's a pthreads
implementation of Apache then any calls into your module
are already on another 'thread' and might even be a few
thread levels deep at the point where your module is
called. The 'Tls' ( Thread Local Storage ) might be already
chewed up.


1. What is the actual return code you are getting from your
attempt to launch a thread?

Is it 'Insufficient system resources?".

2. is this UNIX or Windows we are talking about? Makes
a big difference.

Kevin Kiley

thanks for the detailed mail, i'm actually not at work hand don't have the
sources at home. i try to answer all questions but some things i must check
to 1: the module resists in the php-engine. it's compiled in the php core as
an extension module. in the module a function is called which loads a
dynamic library (dlopen). one of the loaded function creates 2 threads for
bidirectinonal socket communication -this fails. the pointers to the
functions are correct and they are callable.
to 2: i have compiled php as an standalone executable and start it from the
commandline (not trought cgi). -it works.
to 3: i using loadmodule (external dso). compiling into the core is not
checked yet.

the questions:
to 1: the create function does not return. it seems the function is in a
blocking condition. ...after setting the scope to system the thread is
created but in the function which is callin pthread_create wan't return
(seems to be a stack broblem)
to 2: its linux glibc 2.x.x

thomas eisengarten

View raw message