You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ian Ward Comfort <ic...@rescomp.stanford.edu> on 2007/10/23 02:52:10 UTC

mod_jk 1.2.25, JkEnvVar evaluated too many times

(I've heard this list is a good place to discuss mod_jk code; please  
redirect me and accept my apologies if it is not.)

I think I've found a problem with mod_jk 1.2.25 and Apache 2.x,  
whereby JkEnvVar directives are effectively evaluated too many times  
when VirtualHosts are configured.

The problem is apparent on a RHEL4 server of mine running Apache  
2.2.6, with 17 name-based virtual hosts configured for *:80.  I have  
13 JkEnvVars specified, all with default values, in the main server  
configuration.  There are no JK directives within the virtual host  
containers.  By adding some additional instrumentation to the code, I  
can see that each AJP packet is constructed with ((1 + 17) * 13) =  
234 envvar attributes -- the whole set of attributes is appended 18  
times in succession.  (Often this overflows the default maximum  
packet size.)

The source of the trouble seems to be in native/apache-2.0/mod_jk.c,  
in the jk_post_config function, specifically lines 2853-2879 of the  
1.2.25 source.  This code is evaluated many times for the same sconf  
object, as each iteration through the enclosing for loop has a  
different server object, but ap_get_module_config returns the same  
jk_server_conf_t* for all of them.

I would submit a patch for this but I'm no expert in coding Apache  
modules, and I don't want to speculate about the way these  
configurations should be constructed.  If I should dig deeper and  
develop a fix, or provide more information, let me know.

Thanks,
--
Ian Ward Comfort <ic...@rescomp.stanford.edu>
System Administrator, Student Computing, Stanford University


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: mod_jk 1.2.25, JkEnvVar evaluated too many times

Posted by Ian Ward Comfort <ic...@rescomp.stanford.edu>.
On Oct 22, 2007, at 11:24 PM, Mladen Turk wrote:
>> By adding some additional instrumentation to the code, I can see  
>> that each AJP packet is constructed with ((1 + 17) * 13) = 234  
>> envvar attributes -- the whole set of attributes is appended 18  
>> times in succession.  (Often this overflows the default maximum  
>> packet size.)
>
> Can you use JkLogLevel debug and attach the packet dumps as well as  
> the the config?

Sure.  For a little more information, I first applied a small patch  
to the 1.2.25 source [1].  For simplicity's sake I used a stripped- 
down Apache configuration with 3 VirtualHosts and a single JK worker  
[2] [3].  I've posted the resulting log output [4] and tcpdump output  
[5] generated with 'tcpdump -i lo -s 0 -w ajp.dump tcp port 8009'.

[1] http://rescomp.stanford.edu/~icomfort/jk/logging.patch
[2] http://rescomp.stanford.edu/~icomfort/jk/httpd.conf
[3] http://rescomp.stanford.edu/~icomfort/jk/workers.properties
[4] http://rescomp.stanford.edu/~icomfort/jk/mod_jk_log
[5] http://rescomp.stanford.edu/~icomfort/jk/ajp.dump

I get similar results with my fully-configured Apache 2.2.6 server.

Let me know if I can provide any more information.

--
Ian Ward Comfort <ic...@rescomp.stanford.edu>
System Administrator, Student Computing, Stanford University


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: mod_jk 1.2.25, JkEnvVar evaluated too many times

Posted by Mladen Turk <mt...@apache.org>.
Ian Ward Comfort wrote:
> (I've heard this list is a good place to discuss mod_jk code; please 
> redirect me and accept my apologies if it is not.)
> 

No, this is correct place :)

> containers.  By adding some additional instrumentation to the code, I 
> can see that each AJP packet is constructed with ((1 + 17) * 13) = 234 
> envvar attributes -- the whole set of attributes is appended 18 times in 
> succession.  (Often this overflows the default maximum packet size.)
>

Can you use JkLogLevel debug and attach the packet dumps as well as the
the config?

Regards,
Mladen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org