Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-11 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 5/11/18 2:46 PM, Mark Thomas wrote:
> On 08/05/18 17:59, Christopher Schultz wrote: 
> 
>> This bites enough people that it may be worth correcting, or at
>> least changing the behavior when it happens.
>> 
>> AJP already encodes the packet-size in the header of each packet.
>> Why not simply compare that to the MaxPacketSize on the Tomcat
>> side and issue a useful error message instead of whatever is
>> currently happening?
> 
> Done.

Excellent.

> Most likely there would have been an error message logged anyway,
> but that would have been about the next bytes being an invalid
> packet header. Now there is an explicit error logged for the
> message being too big.

I think this will really help in the small number of cases where it
comes up. Most people use the default size or successfully set both
ends of the connection to the max size (65535), but debugging a
mismatch san be a bear.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlr2B0QACgkQHPApP6U8
pFhZURAAxCVvciCTiweb3OTnLg3t/jXeV21nczVc4dspu9z6uRe9NXEN/y88pacv
zFYSiqBrFPWXOM6xHsfVFYllhL3DcjjGP+fWiinPs5OWn+C967EtifwP5IN9c6DG
kV8vPBR0VeAbHJ9ZGETZSOQpr38g8pqnEArWX1kzB4uHx3bxMamWM3vls5Oh07m0
QaMwg4SwFCC0UkVPgYoEXO33/NyaeP5D5+n40lUl7c+HGbx8kWTWh28FnAAEVGfx
xPnvdcwlt1JyNU+wSec1yaQdCvULLyBjGIBcr++K/SiJucpLIR48z/oBfkSimkp+
GtbBU2HoemBiA6ntYChHw8D2Bfg/pm6OK3wObuI+eGInXOiD77qEuqMvGXk8Edx6
BmM7mhrxBSiRbSShgfvmd4bsiWfnXo3lcB5C6buGeqPhgrEyXRRiXRMKZp9fQg++
/NxvkU2Rg0M5NzEZC1DpbMCEzM8vkoTPmu5ztvrA1/8pmgCGSJb09kBChl6sdajx
4xxhFQzPNalePTGpPPf9uJWKua1WQMHdloKpROobZYRyaiBtRSoq7VSTjMT4rPvZ
g5WxKEnIb2cfTyUFzZOfPoNrelM5PoC/3im/8TzxhaRKVXXJ2GX419g6ewBLYCUD
o/fbWQlQJfLCH5NWR6uVJXRi8ARbcjraIjM3VVO2c7HIOYRmMqM=
=UD5P
-END PGP SIGNATURE-

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



Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-11 Thread Mark Thomas
On 08/05/18 17:59, Christopher Schultz wrote:


> This bites enough people that it may be worth correcting, or at least
> changing the behavior when it happens.
> 
> AJP already encodes the packet-size in the header of each packet. Why
> not simply compare that to the MaxPacketSize on the Tomcat side and
> issue a useful error message instead of whatever is currently happening?

Done.

Most likely there would have been an error message logged anyway, but
that would have been about the next bytes being an invalid packet
header. Now there is an explicit error logged for the message being too big.

Mark

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



RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-11 Thread Andreas Bergander
I don't think I saw any error messages at all in Tomcat. Just in the apache 
logs. When I debugged I noticed an EOFException in the AJPProcessor. The 
service method catches all type of IOExceptions and sets the error state but 
doesn't log anything.

/Andreas 

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: den 8 maj 2018 18:59
To: users@tomcat.apache.org
Subject: Re: Changing the packetSize in AJP connector causes 503 Internal 
Server Error in Tomcat 9

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 5/3/18 5:41 AM, Mark Thomas wrote:
> On 03/05/18 10:36, Mark Thomas wrote:
>> On 03/05/18 09:48, Andreas Bergander wrote:
>>> Hi,
>>> 
>>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue 
>>> regarding the packet size in the AJP connector. It seems like only 
>>> the default value (8192) works now. If I set it to anything greater 
>>> than that I'll get 503 Internal Server Error when trying to access a 
>>> web page. It worked fine in 8.5 but now I get EOFExceptions in the 
>>> AJP processor. Has anything changed regarding the packet size? 
>>> Should it still work with values greater than 8192?
>> 
>> It should work but I can confirm that it currently does not. 
>> Investigating now...
> 
> That was easy :)
> 
> You need to remember to change the packet size to be exactly the same 
> value on both Tomcat and httpd.
> 
> When I changed it just on Tomcat (to 2), I saw 503 errors from 
> httpd. Once I changed them both to be 2, everything worked as 
> expected.

This bites enough people that it may be worth correcting, or at least changing 
the behavior when it happens.

AJP already encodes the packet-size in the header of each packet. Why not 
simply compare that to the MaxPacketSize on the Tomcat side and issue a useful 
error message instead of whatever is currently happening?

Andreas, what error message(s) do you see in the log(s) on the Tomcat side when 
this happens?

Or maybe even auto-size the buffer on the Tomcat side to be nice about i t?

Oddly enough, the AJP documentation[1] says that the practical limit of the 
packet size is 8k, though I and probably many others have happily been using 
higher values for quite some time.

- -chris

[1] http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrx12IACgkQHPApP6U8
pFgtAw/+I0Wv4uMERn01xjvuokEnv5daGe0QKTV7Gw6QYMQqb0hJM29yseRmMzDm
NXMFyyaKb5URdrTcxk9Mt5nQVPl0vc8Qmf7CbK8rqntrUN//eGfSdsXxWi987SR6
9bF5/C0+b/KcXlPuT2FRejBsZBwI/mnktWyuBBJ5UHl23q6pL6WmuTjz7PrEVF9O
QfzA6ztlZN3LzICaNVC/h4zmMm+rwR7zL32v/lO3wve9AvrlZIpNI83e0bhYHdm3
TWaF3PCwQGgRKoWPFRw4Hv4Y+VHyMyaNtjc4nKRszk5SwyO9vgiU/VzdRiX+0Lw4
B716nX7E3ETUYYHMr7d02MRhhNoxttc0WhKCqhMMjRskwvCljbtkhyvt7NYR2Zsc
xmMxcPRNjUCxKz01ZWLakZ73s0CvuKSBClRAjDxWoYBmOpz88PHr4YeO4l9ME0Du
fwcnMuRvyNlbsZMz6jAQqDEwfqybvmWTdDGDFlj4+SQxX+Qf5wytbQ4tgTXvYPmx
UiyCjjRi/hLCxxkNvMf0mOcN8nair56Qly6Z1T+JR6ztbSugRAhmZAx8oHtL8HKF
QrR5yVuGJyBdysbkxq1q29bHt9bGHpnzHsifZjHGNk3tQiLWZ5aKkguv0CizmPm8
y7tAAYL9feAkaybeUw7BBb13gANLOpfIQi1NC6iavnrOsG13gBU=
=rEkE
-END PGP SIGNATURE-

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



Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 5/3/18 5:41 AM, Mark Thomas wrote:
> On 03/05/18 10:36, Mark Thomas wrote:
>> On 03/05/18 09:48, Andreas Bergander wrote:
>>> Hi,
>>> 
>>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue
>>> regarding the packet size in the AJP connector. It seems like
>>> only the default value (8192) works now. If I set it to
>>> anything greater than that I'll get 503 Internal Server Error
>>> when trying to access a web page. It worked fine in 8.5 but now
>>> I get EOFExceptions in the AJP processor. Has anything changed
>>> regarding the packet size? Should it still work with values
>>> greater than 8192?
>> 
>> It should work but I can confirm that it currently does not. 
>> Investigating now...
> 
> That was easy :)
> 
> You need to remember to change the packet size to be exactly the
> same value on both Tomcat and httpd.
> 
> When I changed it just on Tomcat (to 2), I saw 503 errors from 
> httpd. Once I changed them both to be 2, everything worked as
> expected.

This bites enough people that it may be worth correcting, or at least
changing the behavior when it happens.

AJP already encodes the packet-size in the header of each packet. Why
not simply compare that to the MaxPacketSize on the Tomcat side and
issue a useful error message instead of whatever is currently happening?

Andreas, what error message(s) do you see in the log(s) on the Tomcat
side when this happens?

Or maybe even auto-size the buffer on the Tomcat side to be nice about i
t?

Oddly enough, the AJP documentation[1] says that the practical limit
of the packet size is 8k, though I and probably many others have
happily been using higher values for quite some time.

- -chris

[1] http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrx12IACgkQHPApP6U8
pFgtAw/+I0Wv4uMERn01xjvuokEnv5daGe0QKTV7Gw6QYMQqb0hJM29yseRmMzDm
NXMFyyaKb5URdrTcxk9Mt5nQVPl0vc8Qmf7CbK8rqntrUN//eGfSdsXxWi987SR6
9bF5/C0+b/KcXlPuT2FRejBsZBwI/mnktWyuBBJ5UHl23q6pL6WmuTjz7PrEVF9O
QfzA6ztlZN3LzICaNVC/h4zmMm+rwR7zL32v/lO3wve9AvrlZIpNI83e0bhYHdm3
TWaF3PCwQGgRKoWPFRw4Hv4Y+VHyMyaNtjc4nKRszk5SwyO9vgiU/VzdRiX+0Lw4
B716nX7E3ETUYYHMr7d02MRhhNoxttc0WhKCqhMMjRskwvCljbtkhyvt7NYR2Zsc
xmMxcPRNjUCxKz01ZWLakZ73s0CvuKSBClRAjDxWoYBmOpz88PHr4YeO4l9ME0Du
fwcnMuRvyNlbsZMz6jAQqDEwfqybvmWTdDGDFlj4+SQxX+Qf5wytbQ4tgTXvYPmx
UiyCjjRi/hLCxxkNvMf0mOcN8nair56Qly6Z1T+JR6ztbSugRAhmZAx8oHtL8HKF
QrR5yVuGJyBdysbkxq1q29bHt9bGHpnzHsifZjHGNk3tQiLWZ5aKkguv0CizmPm8
y7tAAYL9feAkaybeUw7BBb13gANLOpfIQi1NC6iavnrOsG13gBU=
=rEkE
-END PGP SIGNATURE-

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



RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-03 Thread Andreas Bergander
Ah, I see! 

Thank you very much for the quick and helpful answer!

/Andreas

-Original Message-
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: den 3 maj 2018 13:37
To: Tomcat Users List 
Subject: Re: Changing the packetSize in AJP connector causes 503 Internal 
Server Error in Tomcat 9

On 03/05/18 10:59, Andreas Bergander wrote:
> Thank's for investigating Mark!
> 
> I think it's only possible to change the packet size in mod_jk, not in 
> mod_proxy_ajp, right?

Wrong.
ProxyIOBufferSize

Mark

> So either we need to switch to mod_jk or stick with a packet size of 8192.
> 
> A bit strange though that it worked fine in Tomcat 8.5, maybe it adapted to 
> httpd and still used 8192 as a packet size even though we specified 65536 in 
> Tomcat?
> 
> /Andreas
> 
> -Original Message-
> From: Mark Thomas [mailto:ma...@apache.org] 
> Sent: den 3 maj 2018 11:41
> To: Tomcat Users List 
> Subject: Re: Changing the packetSize in AJP connector causes 503 Internal 
> Server Error in Tomcat 9
> 
> On 03/05/18 10:36, Mark Thomas wrote:
>> On 03/05/18 09:48, Andreas Bergander wrote:
>>> Hi,
>>>
>>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the 
>>> packet size in the AJP connector. It seems like only the default value 
>>> (8192) works now. If I set it to anything greater than that I'll get 503 
>>> Internal Server Error when trying to access a web page. It worked fine in 
>>> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed 
>>> regarding the packet size? Should it still work with values greater than 
>>> 8192?
>>
>> It should work but I can confirm that it currently does not.
>> Investigating now...
> 
> That was easy :)
> 
> You need to remember to change the packet size to be exactly the same value 
> on both Tomcat and httpd.
> 
> When I changed it just on Tomcat (to 2), I saw 503 errors from httpd. 
> Once I changed them both to be 2, everything worked as expected.
> 
> Mark
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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


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



Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-03 Thread Mark Thomas
On 03/05/18 10:59, Andreas Bergander wrote:
> Thank's for investigating Mark!
> 
> I think it's only possible to change the packet size in mod_jk, not in 
> mod_proxy_ajp, right?

Wrong.
ProxyIOBufferSize

Mark

> So either we need to switch to mod_jk or stick with a packet size of 8192.
> 
> A bit strange though that it worked fine in Tomcat 8.5, maybe it adapted to 
> httpd and still used 8192 as a packet size even though we specified 65536 in 
> Tomcat?
> 
> /Andreas
> 
> -Original Message-
> From: Mark Thomas [mailto:ma...@apache.org] 
> Sent: den 3 maj 2018 11:41
> To: Tomcat Users List 
> Subject: Re: Changing the packetSize in AJP connector causes 503 Internal 
> Server Error in Tomcat 9
> 
> On 03/05/18 10:36, Mark Thomas wrote:
>> On 03/05/18 09:48, Andreas Bergander wrote:
>>> Hi,
>>>
>>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the 
>>> packet size in the AJP connector. It seems like only the default value 
>>> (8192) works now. If I set it to anything greater than that I'll get 503 
>>> Internal Server Error when trying to access a web page. It worked fine in 
>>> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed 
>>> regarding the packet size? Should it still work with values greater than 
>>> 8192?
>>
>> It should work but I can confirm that it currently does not.
>> Investigating now...
> 
> That was easy :)
> 
> You need to remember to change the packet size to be exactly the same value 
> on both Tomcat and httpd.
> 
> When I changed it just on Tomcat (to 2), I saw 503 errors from httpd. 
> Once I changed them both to be 2, everything worked as expected.
> 
> Mark
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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



RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-03 Thread Andreas Bergander
Thank's for investigating Mark!

I think it's only possible to change the packet size in mod_jk, not in 
mod_proxy_ajp, right? So either we need to switch to mod_jk or stick with a 
packet size of 8192.

A bit strange though that it worked fine in Tomcat 8.5, maybe it adapted to 
httpd and still used 8192 as a packet size even though we specified 65536 in 
Tomcat?

/Andreas

-Original Message-
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: den 3 maj 2018 11:41
To: Tomcat Users List 
Subject: Re: Changing the packetSize in AJP connector causes 503 Internal 
Server Error in Tomcat 9

On 03/05/18 10:36, Mark Thomas wrote:
> On 03/05/18 09:48, Andreas Bergander wrote:
>> Hi,
>>
>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the 
>> packet size in the AJP connector. It seems like only the default value 
>> (8192) works now. If I set it to anything greater than that I'll get 503 
>> Internal Server Error when trying to access a web page. It worked fine in 
>> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed 
>> regarding the packet size? Should it still work with values greater than 
>> 8192?
> 
> It should work but I can confirm that it currently does not.
> Investigating now...

That was easy :)

You need to remember to change the packet size to be exactly the same value on 
both Tomcat and httpd.

When I changed it just on Tomcat (to 2), I saw 503 errors from httpd. Once 
I changed them both to be 2, everything worked as expected.

Mark

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


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



Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-03 Thread Mark Thomas
On 03/05/18 10:36, Mark Thomas wrote:
> On 03/05/18 09:48, Andreas Bergander wrote:
>> Hi,
>>
>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the 
>> packet size in the AJP connector. It seems like only the default value 
>> (8192) works now. If I set it to anything greater than that I'll get 503 
>> Internal Server Error when trying to access a web page. It worked fine in 
>> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed 
>> regarding the packet size? Should it still work with values greater than 
>> 8192?
> 
> It should work but I can confirm that it currently does not.
> Investigating now...

That was easy :)

You need to remember to change the packet size to be exactly the same
value on both Tomcat and httpd.

When I changed it just on Tomcat (to 2), I saw 503 errors from
httpd. Once I changed them both to be 2, everything worked as expected.

Mark

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



Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9

2018-05-03 Thread Mark Thomas
On 03/05/18 09:48, Andreas Bergander wrote:
> Hi,
> 
> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the 
> packet size in the AJP connector. It seems like only the default value (8192) 
> works now. If I set it to anything greater than that I'll get 503 Internal 
> Server Error when trying to access a web page. It worked fine in 8.5 but now 
> I get EOFExceptions in the AJP processor. Has anything changed regarding the 
> packet size? Should it still work with values greater than 8192?

It should work but I can confirm that it currently does not.
Investigating now...

Mark


> 
> I use Tomcat Native APR and mod_proxy_ajp in Apache on the other side.
> 
> /Andreas
> 
> 


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