That makes sense.  The manipulations that map_uri_to_worker() does always
make the string shorter so there is no need to worry about the modifiable
string passed in being too short and needing reallocated.

Trying to fix this in the jk/common code is, I think, a waste of effort.

-- Marc
 

> -----Original Message-----
> From: Bill Barker [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2003 7:16 PM
> To: Tomcat Developers List
> Subject: Re: [j-t-c] Thread problem in jk_uri_worker_map.c
> 
> The easiest solution would be to change the map_uri_to_worker contract to
> be
> that the uri parameter is modifiable.  Then Apache can dup it using the
> request's pool, it looks like IIS is doing this most of the time anyway,
> and
> Netscape isn't using map_uri_to_worker at all.  That leave Domino, which I
> don't really know.
> 
> 
> ----- Original Message -----
> From: "Marc Saegesser" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 15, 2003 3:11 PM
> Subject: [j-t-c] Thread problem in jk_uri_worker_map.c
> 
> 
> I've run into a threading problem in
> /j-t-c/native/jk/common/jk_uri_worker_map.c.  The problem has been around
> for a long time, but I believe the changes checked in for version 1.15 on
> June, 27, 2003 made the problem worse.  I have only been able to reproduce
> the problem on multi-processor machines running under a fairly heavy load.
> Unfortunately, I don't have a good solution, yet.
> 
> The worker map contains a temp pool (jk_uri_worker_map.tp) that is used in
> the map_uri_to_worker() function.  The temp pool is used to store a copy
> of
> the incoming URI so that it can be altered to remove any jsessionid and to
> remove multiple adjacent / characters.
> 
> The problem is that this single pool is shared by all the worker threads
> so
> if multiple threads are executing map_uri_to_worker() simultaneously there
> is a chance that the pool will get corrupted.  This can happen in two
> ways.
> The jk_pool code is not thread safe so the internal state of the pool may
> be
> corrupted.  Second, the map_uri_to_worker() function always calls
> jk_pool_reset() after mapping the URI.  This means that if multiple URIs
> did
> get allocated into the pool without corruption, when the first thread
> finishes it will reset the pool.  This may not create a noticeable problem
> because the memory in the pools isn't overwritten by a reset.  If the
> other
> threads finish before another thread enters map_uri_to_worker() then
> nothing
> will fail.  However, if another thread does enter map_uri_to_worker() then
> its call to jk_pool_strdup() will overwrite some of the previous contents
> of
> the pool and really bad things may happen.
> 
> As I said, I don't have a solution, yet.  Any solution would have to be
> platform independent and also work with all the Web servers that use the
> JK
> plugin (e.g. Apache 1.3, Apache 2.0, ISAPI, Netscape, ...).
> 
> Suggestions?
> 
> -- Marc
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to