Skip Menu |

This queue is for tickets about the HTML-Mason CPAN distribution.

Report information
The Basics
Id: 49031
Status: resolved
Priority: 0/
Queue: HTML-Mason

People
Owner: Nobody in particular
Requestors: morten_bjoernsvik [...] yahoo.no
Cc: cpan [...] chmrr.net
AdminCc:

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



Subject: Broken pipe: core_output_filter: hang
Date: Wed, 26 Aug 2009 17:23:00 +0000 (GMT)
To: bug-HTML-Mason [...] rt.cpan.org
From: morten bjoernsvik <morten_bjoernsvik [...] yahoo.no>
Hi I've been hampered by a hang due to a broken pipe, which never returns the handler, it is critical and we need to restart apache to reset it. [Wed Aug 26 18:42:55 2009] [info] [client 127.0.0.1] (32)Broken pipe: core_output_filter: writing data to the network [Wed Aug 26 18:42:55 2009] [error] [client 127.0.0.1] Apache2::RequestIO::print: (103) Software caused connection abort at /opt/perl/lib/site_perl/5.8.9/HTML/Mason/ApacheHandler.pm line 1019, referer: http://localhost/auth/agent-instances/ In the beginning we only saw it with https calls, but when the database processing grow large in http we saw it there also. Then I realized it was not a https issue. Turns out adding an eval to the hanging call fixes it. I'm not sure if this is correct, but our code works fine with this. Could you please verify and add this workaround. /opt/perl/bin/perl -e 'use HTML::Mason::ApacheHandler; print $HTML::Mason::ApacheHandler::VERSION . "\n"' 1.69 mortenb2:/opt/perl/lib/site_perl/5.8.9/HTML/Mason # cat ApacheHandler_BrokenPipe_hang_fix.patch *** ApacheHandler_orig.pm Wed Aug 26 18:57:53 2009 --- ApacheHandler.pm Wed Aug 26 18:52:20 2009 *************** *** 1012,1023 **** # Craft the request's out method to handle http headers, content # length, and HEAD requests. my $out_method; ! if (APACHE2) { ! # mod_perl-2 does not need to call $r->send_http_headers $out_method = sub { ! $r->$final_output_method( grep { defined } @_ ); ! $r->rflush; }; } else { --- 1012,1027 ---- # Craft the request's out method to handle http headers, content # length, and HEAD requests. my $out_method; ! if (APACHE2) { # mod_perl-2 does not need to call $r->send_http_headers $out_method = sub { ! eval{ ! $r->$final_output_method( grep { defined } @_ ); ! $r->rflush; ! }; ! if($@) { ! return; ! } }; } else { Thanks -- Morten Bjoernsvik, Oslo, Norway Show quoted text
_________________________________________________________ Alt i ett. Få Yahoo! Mail med adressekartotek, kalender og notisblokk. http://no.mail.yahoo.com
Subject: Re: [rt.cpan.org #49031] Broken pipe: core_output_filter: hang
Date: Wed, 26 Aug 2009 12:32:05 -0500 (CDT)
To: "morten_bjoernsvik [...] yahoo.no via RT" <bug-HTML-Mason [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 26 Aug 2009, morten_bjoernsvik@yahoo.no via RT wrote: Show quoted text
> Turns out adding an eval to the hanging call fixes it. I'm not sure if > this is correct, but our code works fine with this.
It seems the blindly ignoring all failures to send output is wrong. Can you figure out what the error looks like in the broken pipe case, and change the patch to rethrow all other exceptions? Also, unified diffs are preferred. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
On Wed Aug 26 13:32:23 2009, autarch@urth.org wrote: Show quoted text
> It seems the blindly ignoring all failures to send output is wrong. Can > you figure out what the error looks like in the broken pipe case, and > change the patch to rethrow all other exceptions? > > Also, unified diffs are preferred.
This is caused by the client pressing stop or ESC in the browser while the data is being computed. The key here is the rflush failure, which is what is attempting to write to the socket for the browser. Attached is a patch against SVN which catches and ignores this error, while rethrowing all other errors. - Alex
Subject: rflush-failure.patch
Index: lib/HTML/Mason/ApacheHandler.pm =================================================================== --- lib/HTML/Mason/ApacheHandler.pm (revision 3950) +++ lib/HTML/Mason/ApacheHandler.pm (working copy) @@ -1016,8 +1016,12 @@ # mod_perl-2 does not need to call $r->send_http_headers $out_method = sub { - $r->$final_output_method( grep { defined } @_ ); - $r->rflush; + eval { + $r->$final_output_method( grep { defined } @_ ); + $r->rflush; + }; + my $err = $@; + die $err if $err and $err !~ /Software caused connection abort/ }; } else {
Fixed in 1.52