httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Gross" <cgr...@eusoft.com>
Subject Re: "Strcasecmp problem"
Date Sat, 03 Aug 1996 00:21:24 GMT
> From: Robert S. Thau <rst@hyperreal.com>
> To: new-httpd@hyperreal.com
> Subject: "Strcasecmp problem"
> Date: samedi, 3. ao{t 1996 02:00
> 
>   The problem is within the init_mime routine and the problem is 
> 
>   static table *hash_buckets[ MIME_HASHSIZE];
> 
> My email seems to be getting lost in the ether again, so I'll try
sending
> from hyperreal (summarizing stuff previously sent), and see if it gets
> through. 
> 
> To summarize --- init_mime is the *only* function which writes that
array.
> BTW, it's pretty weird to say that a data structure is "not
thread-safe";
> if multiple threads are trying to write that array at the same time,
then
> *that* wouldn't be thread-safe --- but that's the code's fault, not the
> array's.
> 
Okay agreed

> So, the only possible conflict is if two threads are calling init_mime
> at the same time.  But that simply shouldn't be happening --- it
certainly
> doesn't happen in stock Apache.  Even if you have multithreaded server
> *startup*, for some unaccountable reason, why are you initializing the
> *same module* more than once?
> 
The problem is as follows.  When I originally looked at the source I did
not know it very well and am still struggling to understand it properly. 
The code was implemented that each thread would be its own mini-server. 
This mimics the behaviour of the process oriented style.  Of course it
would have been more intelligent on my side to actually allocate the
server structure once and then use it between the threads.  But that is
not possible without altering many of the structures.  My aim was to
simply get the Apache running on NT and nothing more.

For example in the structure server_rec there is are two members
server_rec::pconf
server_rec::ptrans
The first item is not problem.  Its a pointer to the pool of data used to
allocate the server structure.  Now the second item is problematic because
ptrans is a transient pointer that is pre transactions specific (BTW
correct me if I am wrong)  If there was a global server_rec structure then
the ptrans could not be shared among the threads.  This introduces
problems.  Hence the reasoning of allocating a per thread a server
structure.  As well hence the problem of the inits being called multiple
times.

I think if we were to port the Apache to threads we will have to take a
look at what the structures do specifically.  


> in short, I'm not completely persuaded of your diagnosis; even if it
> is correct, I think it is better to figure out why init_mime is being
> called by multiple threads, and stop it, than to change that particular
> code.
> 
See above...

-- 
Christian Gross
euSOFT
Phone 41.1.492.7827
Fax 41.1.492.7757
http://www.eusoft.com
cgross@eusoft.com

Mime
View raw message