Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 53226
Status: rejected
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: bobtfish [...] bobtfish.net
Requestors: felix.ostmann [...] thewar.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 5.80016
Fixed in: (no value)



Subject: Wrong Content-Length error
we receive daily ~20 errors with Wrong Content-Length (paranoia against wrong Content-Length header) error message.

I added some debug messages and every error we got there is the body empty. So the client tell length is X and did not send any body. It would be nice if that special case can be checked befor someone goes paranoia :)
Subject: Catalyst-Engine.patch
--- Engine.pm.orig 2009-12-30 10:58:53.000000000 +0100 +++ Engine.pm 2009-12-30 11:02:29.000000000 +0100 @@ -347,8 +347,10 @@ my $remaining = $length - $self->read_position; if ( $remaining > 0 ) { $self->finalize_read($c); - Catalyst::Exception->throw( - "Wrong Content-Length value: $length" ); + if( $self->read_position > 0 ) { + Catalyst::Exception->throw( + "Wrong Content-Length value: $length" ); + } } } else {
I'm not sure if I'm comfortable with the idea of just blanking the warning message until we know a bit more about what's going on.

Can you change the code to dump the request when this happens so we can see if it's a specific user-agent and/or request type that's triggering the error? Also, can you give me some more information about your deployment environment (what engine you're using etc), as this may be helpful.

Thanks in advance
t0m

Catalyst Version: 5.71001 Browser: Opera, IE6-8, Firefox, Chrome Engine: FastCGI, Self server, Apache13 [info] *** Request 1 (0.250/s) [67679] [Wed Jan 13 11:48:23 2010] *** [debug] "GET" request for "login" from "81.19.90.138" [debug] Path is "login" [debug] Rendering template "login/index.tt2" [info] Request took 0.629321s (1.589/s) .------------------------------------------------------------+-----------. | Action | Time | +------------------------------------------------------------+-----------+ | /auto | 0.000512s | | /login/index | 0.000276s | | /end | 0.405760s | | -> Katrin::View::TT->process | 0.400559s | '------------------------------------------------------------+-----------' [info] *** Request 2 (0.286/s) [67679] [Wed Jan 13 11:48:26 2010] *** [debug] "POST" request for "login" from "81.19.90.138" [debug] Path is "login" [debug] Rendering template "login/index.tt2" [info] Request took 0.200612s (4.985/s) .------------------------------------------------------------+-----------. | Action | Time | +------------------------------------------------------------+-----------+ | /auto | 0.000314s | | /login/index | 0.000302s | | /end | 0.175948s | | -> Katrin::View::TT->process | 0.172058s | '------------------------------------------------------------+-----------' [info] *** Request 3 (0.273/s) [67679] [Wed Jan 13 11:48:30 2010] *** [error] Caught exception in engine "Wrong Content-Length value: 33 at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst.pm line 1811"
From: felix.ostmann [...] thewar.de
What is the best way to suppress this error? I am not sure at which point i can intervene that my logs dont get this error. We want to work with a panic-log, but this is not possible while this error occure ~50 times a day. The error itself comes from bad clients i think.
From: felix.ostmann [...] thewar.de
There was a small discussion about this at the mailing list. Perhabs a patch for configure this warning? be_paranoid=1? i dont want to build around this warning myself :-/
On Wed Jan 13 06:49:38 2010, SHV wrote: Show quoted text
> Catalyst Version: 5.71001
This is an ancient version! Show quoted text
> Engine: FastCGI, Self server, Apache13
Apache 1.3 is unsupported (by apache), and FCGI.pm has changed a load recently, and we've gutted all the engines for Plack.. Can you still reproduce this? Show quoted text
> [info] *** Request 3 (0.273/s) [67679] [Wed Jan 13 11:48:30 2010] *** > [error] Caught exception in engine "Wrong Content-Length value: 33 at > /usr/local/lib/perl5/site_perl/5.8.9/Catalyst.pm line 1811"
Ok, what does the actual content look like, are any of the unicode plugins in play, how wrong is it?
From: felix.ostmann [...] thewar.de
We are using apache 2.2 and catalyst 5.80032 $ apache2 -v Server version: Apache/2.2.9 (Debian) Server built: Sep 4 2011 20:51:55 $ perl -MCatalyst\ 999 -e '' Catalyst version 999 required--this is only version 5.80032. Error occure sometimes a day, the content-length is set, but there is no body, so i think the client is broken. I cannot see a codechange, that will help at this error and i cannot test vs current version. Error only hit us in production. Am Di 04. Okt 2011, 20:31:34, BOBTFISH schrieb: Show quoted text
> On Wed Jan 13 06:49:38 2010, SHV wrote:
> > Catalyst Version: 5.71001
> > This is an ancient version! >
> > Engine: FastCGI, Self server, Apache13
> > Apache 1.3 is unsupported (by apache), and FCGI.pm has changed a load > recently, and we've gutted all the engines for Plack.. Can you still > reproduce this? >
> > [info] *** Request 3 (0.273/s) [67679] [Wed Jan 13 11:48:30 2010]
*** Show quoted text
> > [error] Caught exception in engine "Wrong Content-Length value: 33
at Show quoted text
> > /usr/local/lib/perl5/site_perl/5.8.9/Catalyst.pm line 1811"
> > Ok, what does the actual content look like, are any of the unicode > plugins in play, how wrong is it? >
From: KnowZeroX [...] yahoo.com
I do not know if this is related or not but I am also experiencing issues with wrong content-length. I am using IIS7.5 and FCGI. The problem happens when the header is HUGE and for some reason Content- Length is outputted before the other items in the header are calculated. This becomes a critical problem on IE9 and on FireFox with slow connections when using Redirect. IE9 for some reason takes a long time to load and then aborts. FireFox under slow connection thinks its a file and downloads it as an octet-stream. I effectively had to stop using $c->res->redirect() for large url redirects and swap to using $c->res->headers->header('Location'=>'...'). This makes the content-length render correctly. And avoid the above 2 issues mentioned. Below is an example of an incorrect content-length being rendered early with $c->res->redirect(). Key Value Response HTTP/1.1 302 Found Cache-Control no-cache Content-Length 2590 Content-Type text/html; charset=UTF-8 Location http://google.com/0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|2 1|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|4 5|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|6 9|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|9 3|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112| 113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130| 131|132|133|134|135|136|137|138|139|140|141|142|143|144|145|146|147|148| 149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166| 167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184| 185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202| 203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220| 221|222|223|224|225|226|227|228|229|230|231|232|233|234|235|236|237|238| 239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255|256| 257|258|259|260|261|262|263|264|265|266|267|268|269|270|271|272|273|274| 275|276|277|278|279|280|281|282|283|284|285|286|287|288|289|290|291|292| 293|294|295|296|297|298|299|300|301|302|303|304|305|306|307|308|309|310| 311|312|313|314|315|316|317|318|319|320|321|322|323|324|325|326|327|328| 329|330|331|332|333|334|335|336|337|338|339|340|341|342|343|344|345|346| 347|348|349|350|351|352|353|354|355|356|357|358|359|360|361|362|363|364| 365|366|367|368|369|370|371|372|373|374|375|376|377|378|379|380|381|382| 383|384|385|386|387|388|389|390|391|392|393|394|395|396|397|398|399|400| 401|402|403|404|405|406|407|408|409|410|411|412|413|414|415|416|417|418| 419|420|421|422|423|424|425|426|427|428|429|430|431|432|433|434|435|436| 437|438|439|440|441|442|443|444|445|446|447|448|449|450|451|452|453|454| 455|456|457|458|459|460|461|462|463|464|465|466|467|468|469|470|471|472| 473|474|475|476|477|478|479|480|481|482|483|484|485|486|487|488|489|490| 491|492|493|494|495|496|497|498|499|500|501|502|503|504|505|506|507|508| 509|510|511|512|513|514|515|516|517|518|519|520|521|522|523|524|525|526| 527|528|529|530|531|532|533|534|535|536|537|538|539|540|541|542|543|544| 545|546|547|548|549|550|551|552|553|554|555|556|557|558|559|560|561|562| 563|564|565|566|567|568|569|570|571|572|573|574|575|576|577|578|579|580| 581|582|583|584|585|586|587|588|589|590|591|592|593|594|595|596|597|598| 599|600 Server Microsoft-IIS/7.5 Date Wed, 11 Apr 2012 21:57:00 GMT Here it is being rendered correctly with using $c->res->headers- Show quoted text
>header('Location'=>'...'):
Key Value Response HTTP/1.1 302 Found Cache-Control no-cache Content-Type text/html; charset=UTF-8 Location http://google.com/0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|2 1|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|4 5|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|6 9|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|9 3|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112| 113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130| 131|132|133|134|135|136|137|138|139|140|141|142|143|144|145|146|147|148| 149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166| 167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184| 185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202| 203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220| 221|222|223|224|225|226|227|228|229|230|231|232|233|234|235|236|237|238| 239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255|256| 257|258|259|260|261|262|263|264|265|266|267|268|269|270|271|272|273|274| 275|276|277|278|279|280|281|282|283|284|285|286|287|288|289|290|291|292| 293|294|295|296|297|298|299|300|301|302|303|304|305|306|307|308|309|310| 311|312|313|314|315|316|317|318|319|320|321|322|323|324|325|326|327|328| 329|330|331|332|333|334|335|336|337|338|339|340|341|342|343|344|345|346| 347|348|349|350|351|352|353|354|355|356|357|358|359|360|361|362|363|364| 365|366|367|368|369|370|371|372|373|374|375|376|377|378|379|380|381|382| 383|384|385|386|387|388|389|390|391|392|393|394|395|396|397|398|399|400| 401|402|403|404|405|406|407|408|409|410|411|412|413|414|415|416|417|418| 419|420|421|422|423|424|425|426|427|428|429|430|431|432|433|434|435|436| 437|438|439|440|441|442|443|444|445|446|447|448|449|450|451|452|453|454| 455|456|457|458|459|460|461|462|463|464|465|466|467|468|469|470|471|472| 473|474|475|476|477|478|479|480|481|482|483|484|485|486|487|488|489|490| 491|492|493|494|495|496|497|498|499|500|501|502|503|504|505|506|507|508| 509|510|511|512|513|514|515|516|517|518|519|520|521|522|523|524|525|526| 527|528|529|530|531|532|533|534|535|536|537|538|539|540|541|542|543|544| 545|546|547|548|549|550|551|552|553|554|555|556|557|558|559|560|561|562| 563|564|565|566|567|568|569|570|571|572|573|574|575|576|577|578|579|580| 581|582|583|584|585|586|587|588|589|590|591|592|593|594|595|596|597|598| 599|600 Server Microsoft-IIS/7.5 Date Fri, 13 Apr 2012 03:25:38 GMT Content-Length 2434 Notice the difference? it is exactly the same headers and exactly same content but using the headers->header the content length is correct and is at the bottom, while using the built in redirect function we get a different content-length and it is all the way on top. If I remember correctly the PSGI server did not experience this issue. (been a long day trying to figure out what is causing this and finding a solution) I don't know if its related or not, if not then I'll create a new ticket for this issue.
On Thu Apr 12 23:39:39 2012, KnowZeroX@yahoo.com wrote: Show quoted text
> I do not know if this is related or not but I am also experiencing > issues with wrong content-length. I am using IIS7.5 and FCGI. > > The problem happens when the header is HUGE and for some reason Content- > Length is outputted before the other items in the header are calculated.
I think this is a different issue, however I have seen this before (not with IIS), so I think it's a general issue - I'll try to get a test setup to replicate this next week, and do some further investiagtion..
From: KnowZeroX [...] yahoo.com
Show quoted text
> I think this is a different issue, however I have seen this before (not > with IIS), so I think it's a general issue - I'll try to get a test > setup to replicate this next week, and do some further investiagtion..
Ok, again thanks for the quick responses. Should I create a new ticket for this or keeping it inside this one is fine?
From: KnowZeroX [...] yahoo.com
Following up on this, is there any reason why catalyst creates its own object has moved body? Looking at a few places like Yahoo does redirecting they don't send any body or even content-length at all when redirecting.
From: KnowZeroX [...] yahoo.com
Playing around with this more I think the culprit might be FastCGI + Keep Alive. By disabling Keep Alive I stopped getting octet errors in FireFox. The following is an example once I download the octet stream to my pc: (notice how its cut off and how the object has moved is written on top of the headers: g/1999/xhtml"> <head> <title>Moved</title> </head> <body> <p>This item has moved <a href="/test/test/">here</a>.</p> </body> </html> HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Vary: Accept-Encoding Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Sun, 20 May 2012 00:36:18 GMT Content-Length: 1924 *gzip encrypted content*
We've totally redone all the content length stuff, and unless I hear otherwise I am considering this ticket closed