tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rossbach ...@objektpark.de>
Subject mod_jk 1.2.20 max_packet_size handling
Date Tue, 12 Dec 2006 18:04:59 GMT
Hi Rainer and Mladen,

I made the paketSize port to tomcat 5.5 tree. Now, I start some  
testing and ...

- I have successfull send more than 8k to the client with a download  
request.
But I must patch o.a.c.connector.Response and  
AjpAprProcessor.SocketOutputBuffer
and JkInputStream to set correct outputbuffer size. Currenty I'm not  
port this back to tomcat 6.0.x!

- second use case: Test a post file upload
mod_jk don't send more then 8k at a fileupload request!

use case: - ( Sorry for the long description)

Send a http POST file upload

--
Request:

POST /fileupload/fileuploaddemo.jsp HTTP/1.1
Accept: */*
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=246F48F8E1C82B3EB7B800EEDA3256BB.node01
Referer: http://127.0.0.1:2090/fileupload/fileuploaddemo.htm
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de-de)  
AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3
Content-Length: 16832
Content-Type: multipart/form-data; boundary=----------0xKhTmLbOuNdArY
Connection: keep-alive
Host: 127.0.0.1:2090

------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="name"

16k.bin-5
------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="myimage"; filename="16k-5.bin"
Content-Type: application/macbinary

i}s͌ 94^~>s73=a܂1;A47؎{>+W/@Θn;XPn 
$![|oHsη#E<
>4ԬGOlQA7f镎PUnk(XQj6d	d"_<|T; 
.iڬȫ^ZGG'?;HߤK}drxwLXlzo9 
YtਂnJJ02=B1wt	-9æXT^=AsceCEp 
,SY?"M.iěRO0$rW^xw>g']{VZ@}P*1 
{s1*@_DNkJtpd2'q"EqRb}R>!6. 
\VY[c~R_Td02mY1}`5A{L 
O35bJ"Jk7LW,*2Re֋9͠/d& 
X`cn(⤐[{T-#J`mHw#ƙ!p6* 
LVLAmHv%b8^"IB[g/	ih}ؐxm@6| 
I]F9;a'r|k\Y:UМCOtBzQ0{o9 
dXӘqsWM{-mY0|yȏ(S,trZt󣑵ڴ] 
.:S.0Z{iQ&9cdkG	Wyc4]l@Ә$4cufɚ*
 >
%Hbzw^+?72\dBf3( ([bڊRtZڙ,
	b>wt)b אBNP~;c5Fd7c96D%<ɩZ6<  
zO98W{ !pG[cTH7j ĥN""Lt:8 
$2BT}=ZҨ
dLJHN^>ѕ#1ድ>7`ڍRMr~ 
>Er$͞v`)2mg\a?t wϡF.-kG="b/۸d 
5u%])>⟗riGme¿mr<?抑"Oo 
ĠiZz '+*Ȥ=ڛ$G}T/$A8-Vɀx7CM] 
j=C|:1w@U)ABzv neNt0JSj죚Ig	RA0` 
+vT4گZs\`mLW0E-C);	s~D6k  
M"/0n9`Khb3Oe? _I[ 
݅VRהp i-'0QNzQo${
eP^"X`xQ1)f;sA>͔NZIUl\#Զ>- 
'a !~=M?`e Ba3ӬK
MӖ/"%6Nо/a$ihZBw*;HŠ ɢ 
SlD;jү^a&VJ<c~aN[&fcvY	m~ִ0x 
ۥF޹|{BTyT6X| Z/E̢U| mR<ZÑr4`% 
0s)8ToéHs"ťfc=T%xf61㵕nZyV 
7?^3lZu<VdzB<}/iVvdLglEoc6K 
9v*3N"(XR``d<yL!5@ݨ45[ĭޑ++OM% 
nt,xƜ"^0LD#'F-[S{ }{j}q),Dn><X 
n'^W)U3;B}2 O$^Kܲ,.] 
NGnjCmC%:197tmgl^hwDO_%dG1b,$}aQ=7 
[kD}(7^~k$?ZGN$0HpiK)JxSpVX" 
n^v36yn
)

== SNIP ==


== mod_jk log analyse: ===

a)Apache  -> JK_AJP13_FORWARD_REQUEST -> Tomcat )
jk_ajp_common.c (893): sending to ajp13 pos=4 len=450 max=16384
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (893): 0000    12 34 01 BE 02 04 00 08 48 54 54 50 2F  
31 2E 31
- .4......HTTP/1.1
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::

b) only 8k are sent (Apache  -> DATA -> Tomcat )
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_send_request::jk_ajp_common.c
(1273): request body to send 16832 - request body to resend 0
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_read_into_msg_buff::jk_ajp_co
mmon.c (1098): enter
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_read_fully_from_server::jk_aj
p_common.c (1052): enter
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_read_into_msg_buff::jk_ajp_co
mmon.c (1135): exit
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (889): enter
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (893): sending to ajp13 pos=4 len=8192 max=16384
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (893): 0000    12 34 1F FC 1F FA 2D 2D 2D 2D 2D 2D 2D  
2D 2D 2D
- .4....----------

== max is 16 k ==

c) Tomcat answer please send more packet size max 16k (Apache  <-  
JK_AJP13_GET_BODY_CHUNK <- Tomcat )
Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_get_message::j
k_ajp_common.c (1029): received from ajp13 pos=0 len=3 max=16384
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_get_message::j
k_ajp_common.c (1029): 0000    06 3F FA 00 00 00 00 00 00 00 00 00 00  
00 00 00
- .?..............
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_connection_tcp_get_message::j
k_ajp_common.c (1035): exit

d) but only 8k are sent again (Apache  -> DATA -> Tomcat )
...
k_ajp_common.c (1029): received from ajp13 pos=0 len=3 max=16384

[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_process_callback::jk_ajp_comm
on.c (1461): exit
[Tue Dec 12 13:09:57 2006] [5167:0000] [trace]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (889): enter
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (893): sending to ajp13 pos=4 len=8192 max=16384
[Tue Dec 12 13:09:57 2006] [5167:0000] [debug]  
ajp_connection_tcp_send_message::
jk_ajp_common.c (893): 0000    12 34 1F FC 1F FA FB F7 CE A6 2F AC 2B  
FF 23 42
- .4......../.+.#B

e) Tomcat answer, please send more with packet size 16k (Apache  <-  
JK_AJP13_GET_BODY_CHUNK <- Tomcat )
...
f) rest are send (Apache  -> DATA -> Tomcat )
...
g) tomcat response header and body are send
...
h) Tomcat send end response

OK, but why mod_jk don't use configured max packet size?

===

==== mod_jk 1.2.20 config

<IfModule !mod_jk.c>
   LoadModule jk_module "modules/mod_jk.so"
</IfModule>
JkShmFile "logs/mod_jk.shm"

JkLogFile "logs/mod_jk.log"
JkLogLevel trace

JKWorkerProperty worker.list=loadbalancer,jkstatus
JKWorkerProperty worker.node01.port=7309
JKWorkerProperty worker.node01.host=localhost
JKWorkerProperty worker.node01.type=ajp13
JKWorkerProperty worker.node01.max_packet_size=16384
JKWorkerProperty worker.loadbalancer.balance_workers=node01
JKWorkerProperty worker.loadbalancer.type=lb
JKWorkerProperty worker.jkstatus.type=status
JkMount /jkstatus jkstatus
JkMount /last* loadbalancer
JkMount /fileupload* loadbalancer

====

search at mod_jk source and found following hardcoded size cutter:
====

jk_ajp_common.c

L1444:
  case JK_AJP13_GET_BODY_CHUNK:
         {
             int len = (int)jk_b_get_int(msg);

             if (len < 0) {
                 len = 0;
             }
             if (len > AJP13_MAX_SEND_BODY_SZ) {
                 len = AJP13_MAX_SEND_BODY_SZ;

The size at tomcat SEND_BODY message are cut to default and not to  
worker max_paket_size

Why the first send body not use the worker max_packet_size:

L1341 ??
        if (ae->left_bytes_to_send > 0) {
             int len = ae->left_bytes_to_send;
             if (len > AJP13_MAX_SEND_BODY_SZ) {
                 len = AJP13_MAX_SEND_BODY_SZ;

Other fix length setting found at  L1101
    read_buf += AJP_HEADER_LEN; /* leave some space for the buffer  
headers */
     read_buf += AJP_HEADER_SZ_LEN;      /* leave some space for the  
read length */

     /* Pick the max size since we don't know the content_length */
     if (r->is_chunked && len == 0) {
         len = AJP13_MAX_SEND_BODY_SZ;
     }

Wrong or right?

Regards
Peter




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message