You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by fredk2 <fr...@gmail.com> on 2009/03/03 20:12:31 UTC

Is there a known Header limit in mod_jk (or bug)?

Hi, 

When I send a request to Tomcat via mod_jk I get the following error (code
413): 

Request Entity Too Large 
The requested resource 
/myapp/jsp/cookieshowvalue.jsp 
does not allow request data with GET requests, or the amount of data
provided in the request exceeds the capacity limit. 

I total size of my headers/cookies is about 7.5KB on Solaris 10 and 9.8KB on
RH Linux. I made sure that Apache's limit was set above its default of 8K
(LimitRequestFieldSize 25000) 

The mod_jk logfiles shows: 
[Mon Mar 02 14:42:22.856 2009] [27893:4136860560] [error]
ajp_marshal_into_msgb::jk_ajp_common.c (417): failed appending the header
value 
[Mon Mar 02 14:42:22.856 2009] [27893:4136860560] [info]
ajp_service::jk_ajp_common.c (2042): Creating AJP message failed, without
recovery 
[Mon Mar 02 14:42:22.856 2009] [27893:4136860560] [info]
service::jk_lb_worker.c (1188): unrecoverable error 413, request failed.
Client failed in the middle of request, we can't recover to another
instance. 
[Mon Mar 02 14:42:22.856 2009] myWorker test.domain.com
/myapp/jsp/cookieshowvalue.jsp 200 0.000316 0 HTTP/1.1 GET 
[Mon Mar 02 14:42:22.856 2009] [27893:4136860560] [info]
jk_handler::mod_jk.c (2357): Aborting connection for worker=myWorker 

The problem is apparent with any version of Apache or mod_jk or Tomcat (I am
testing with 2.2.11, 1.2.26, 6.0.14).

I read the following doc
http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html which says there is
no limit: 

"This works on the assumption that no header names will have length greater
than 0x9999 (==0xA000 - 1), which is perfectly reasonable, though somewhat
arbitrary. (If you, like me, started to think about the cookie spec here,
and about how long headers can get, fear not -- this limit is on header
names not header values. It seems unlikely that unmanageably huge header
names will be showing up in the HTTP spec any time soon)." 

I tried to read some of the source code jk_ajp_common.c ... but i cannot
figure out where the limit for the header array(s) comes from. 

I then tested with the attributes worker.properties->max_packet_size and
server.xml->packetSize. It appears to fix the large header problem. 

Does this mean that all the headers (thus cookies) together have to fit into
a buffer which size is set by max_packet_size? 

Rgds, Fredk 
-- 
View this message in context: http://www.nabble.com/Is-there-a-known-Header-limit-in-mod_jk-%28or-bug%29--tp22315525p22315525.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Is there a known Header limit in mod_jk (or bug)?

Posted by Rainer Jung <ra...@kippdata.de>.
On 03.03.2009 20:12, fredk2 wrote:
> When I send a request to Tomcat via mod_jk I get the following error (code
> 413):
>
> Request Entity Too Large
> The requested resource
> /myapp/jsp/cookieshowvalue.jsp
> does not allow request data with GET requests, or the amount of data
> provided in the request exceeds the capacity limit.
>
> I total size of my headers/cookies is about 7.5KB on Solaris 10 and 9.8KB on
> RH Linux. I made sure that Apache's limit was set above its default of 8K
> (LimitRequestFieldSize 25000)
>
> The mod_jk logfiles shows:
> [Mon Mar 02 14:42:22.856 2009] [27893:4136860560] [error]
> ajp_marshal_into_msgb::jk_ajp_common.c (417): failed appending the header
> value

...

> The problem is apparent with any version of Apache or mod_jk or Tomcat (I am
> testing with 2.2.11, 1.2.26, 6.0.14).
>
> I read the following doc
> http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html which says there is
> no limit:
>
...

at the end of the (very old page) it contains the following statement:

What happens if the request headers > max packet size? There is no 
provision to send a second packet of request headers in case there are 
more than 8K (I think this is correctly handled for response headers, 
though I'm not certain). I don't know if there is a way to get more than 
8K worth of data into that initial set of request headers, but I'll bet 
there is (combine long cookies with long ssl information and a lot of 
environment variables, and you should hit 8K easily). I think the 
connector would just fail before trying to send any headers in this 
case, but I'm not certain.

> I tried to read some of the source code jk_ajp_common.c ... but i cannot
> figure out where the limit for the header array(s) comes from.
>
> I then tested with the attributes worker.properties->max_packet_size and
> server.xml->packetSize. It appears to fix the large header problem.
>
> Does this mean that all the headers (thus cookies) together have to fit into
> a buffer which size is set by max_packet_size?

Exactly, that's the correct and only way around the problem.

Regards,

Rainer

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