[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modules
Subject:    Re: [apache-modules] Re: Thread
From:       rm () fabula ! de
Date:       2004-01-13 19:32:00
Message-ID: 20040113193200.GJ11420 () www
[Download RAW message or body]

On Tue, Jan 13, 2004 at 06:37:58PM +0100, Marco Spinetti wrote:
> I'm using Red Hat Linux 7.1 with
> 
> kernel 2.4.2-2
> glibc-2.2.4-31 and it's pthreds
> 
> So the results is that I can't use pthreads to manage different 
> connections inside the handler of an apache module.
> 
> I think is a great limitation: apache 1.3.x is the most famous web 
> server in the world but it doesn't let you to use pthreads inside it.

Maybe there was a reason that 2.n.n was started ? ;-)

> Blahhhh.......
> 
> I have worked for nothing: I can put all my work in the bathroom........

Oh come on, either have a look at 2.n.n and the apr_xxx polling API
or unroll your threads into a 'select' loop with a state machine.

RalfD

> 
> I'm furious.
> 
> 
> --Marco
> 
> 
> 
> 
> howard J meadows wrote:
> 
> >What platfrom are you running on?
> >If you're running on Linux pthreads often don't work anyhow (even with 
> >Apache2)(you usually need a different kernel).
> >On Apache1.3 you can't use pthreads to start off requests / sub-requests 
> >without that weird behaviour discussed. But you should be able to use them 
> >for simpler tasks.
> >
> >HTH
> >
> >Howard
> >--
> >
> >--------- Original Message ---------
> >
> >DATE: Tue, 13 Jan 2004 18:02:32
> >From: Marco Spinetti <m.spinetti@pisa.iol.it>
> >To: apache-modules@covalent.net
> >Cc: 
> >
> > 
> >
> >>No,
> >>
> >>I'm starting threads in child process (inside handler function) not 
> >>during reading of configuration data.
> >>
> >>Reading your email it seems that using pthreads inside child process in 
> >>apache 1.3.x gives strange results and it will not work as expected, 
> >>while using apache 2 all is ok.
> >>
> >>Is it true?
> >>
> >>If it is, I have a big problem becasue  my module is for apache 1.3.x
> >>
> >>
> >>What is the right and real answer?
> >>
> >>Regards
> >>
> >>
> >>--Marco
> >>
> >>
> >>
> >>Alex (Oleksiy) Bolgarov wrote:
> >>
> >>   
> >>
> >>>--- Marco Spinetti <m.spinetti@pisa.iol.it> wrote: >
> >>>Hi all,
> >>>
> >>>
> >>>     
> >>>
> >>>>I have implemented my module: inside it I start 5
> >>>>pthreads. Each one 
> >>>>starts a different connection.
> >>>>
> >>>>I'm using apache 1.3.27.
> >>>>
> >>>>My big problem is if I start apache with:
> >>>>
> >>>>/usr/local/apache/bin/httpd -X -f
> >>>>/usr/local/apache/conf/httpd.conf -c 
> >>>>'Port 80'
> >>>>
> >>>>all is ok.
> >>>>
> >>>>But if I start apache normally
> >>>>(/usr/local/apache/bin/apachectl start) 
> >>>>my apache module never returns from
> >>>>pthread_cond_wait.
> >>>>  
> >>>>
> >>>>       
> >>>>
> >>>Apache 1.3.X forks child processes to process
> >>>requests. You should remember that after fork(), in
> >>>the child process only one thread is running - the one
> >>>that calls fork() (see man pthread_atfork, or even
> >>>better google for pthread_atfork()). I guess you start
> >>>therads when you are reading configuration directievs,
> >>>right? Those threads are staretd in the parent Apache
> >>>process. When Apache decides it needs to start new
> >>>child process to process a request, it fork()s, and in
> >>>the child process your threads just are not running!
> >>>
> >>>Now, you do not see this when starting Apache with -X
> >>>option, because, if I remember correctly, -X means
> >>>"run Apache in one process without forking", to
> >>>provide nice debug environment for module development.
> >>>If you run Apache via apachectl, no -X option is given
> >>>to httpd and Apache start forking new processes.
> >>>
> >>>So, this means bacically that you _can_ use threads in
> >>>Apache 1.3 module, in a sence that it will compile and
> >>>run without crashes, but it usually will not work as
> >>>expected.
> >>>
> >>>On the other hand I have very positive experience
> >>>using threads in the module for Apache 2 with "worker"
> >>>or "perchild" MPMs. You just make sure that you start
> >>>threads in the child process, not ini parent during
> >>>reading of configuration data.
> >>>
> >>>
> >>>Thank you, 
> >>>
> >>>  alex.
> >>>
> >>>______________________________________________________________________ 
> >>>Post your free ad now! http://personals.yahoo.ca
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
> >>>For additional commands, e-mail: apache-modules-help@covalent.net
> >>>
> >>>
> >>>
> >>>
> >>>     
> >>>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
> >>For additional commands, e-mail: apache-modules-help@covalent.net
> >>
> >>
> >>   
> >>
> >
> >
> >
> >____________________________________________________________
> >Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
> >http://login.mail.lycos.com/r/referral?aid=27005
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
> >For additional commands, e-mail: apache-modules-help@covalent.net
> >
> >
> > 
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
> For additional commands, e-mail: apache-modules-help@covalent.net

---------------------------------------------------------------------
To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
For additional commands, e-mail: apache-modules-help@covalent.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic