httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: mutex in palloc
Date Thu, 11 Dec 1997 19:01:26 GMT
I doubt this is a problem anywhere other than mod_example.  No other
module (of ours) should be maintaining state across requests.  mod_rewrite
has global data for the map file/db, but I thought that was protected? 

mod_unique_id is documented as not working on a multithreaded server (and
it won't compile).  This isn't so much because of global data, but because
of the theory used to construct the unique_id... it needs a modification
to the unique_id in a threaded server. 

If a module puts modifiable state into structures allocated at config time
then they have many subtle bugs already I'm sure.  The structures
allocated at config time should be considered constant at run time... 
because "config time" is a misnomer, it can happen during every single
request too (.htaccess files).  The init/init_child functions are
documented as supplying a pool which has a particular lifetime... I don't
think our modules have problems with them.  What's missing is an
init_thread. 

Dean

On Thu, 11 Dec 1997, Ben Hyde wrote:

> Ben Laurie wrote:
> >Assuming that people will guess correctly still seems rash to me.
> 
> Mod_example has got a rash.  It maintains a history in a
> module local pool with out any mutual exclusion.  I
> guess dis module is not thread safe.
> 
> Presumably this rash pops out when ever a module
> attempts to maintain any state that crosses 
> request boundries (cookies, caches, users, tracking,
> sessions, connections).
> 
> Bummer this could lead to having to revisit a lot of
> modules.  It maybe approprate to assume modules are
> not thread safe and serialize calling into them with
> a per module mutex implemented in the core.
> 
> Writing a thread safe module requires a bag of tricks.
> Beware of those global pools that got passed during
> configuration, just for example.
> 
>  - ben
> 
> ps. permanent_pool shouldn't be a global.
> 


Mime
View raw message