Forum: Ruby on Rails With streaming on, closed client connections cause Fatal Broken Pipe errors

Posted by Daniel Lucraft (lucraft)
on 2012-11-16 13:02
(Received via mailing list)
Once we turned streaming on on www.songkick.com, we started getting 
these
errors on production quite a bit. (See below)

It appears that if the client closes the connection during the rendering 
of
the template, the next attempt to write a portion of the page to the
connection will fail with a Broken Pipe error, understandably. Rails
catches this and turns it into a ActionView::Template::Error.

So these are benign errors, but I'd like to stop them happening or 
silence
them.

1. Where can we register a handler in Rails (3.2) to process template
errors?
2. Should the StreamingTemplateRenderer be catching these broken pipe
errors and suppressing them, perhaps with a "Request Aborted" log line?

thanks
Dan

Error follows:

FATAL skweb(       Rails::ActionController): ActionView::Template::Error
(Broken pipe):

    44:     <%= shared_component('site_header', @page.site_header) %>


    45:     <%= shared_component(@page.site_navigation.component_name,
@page.site_navigation) %>

    46:     <div id="page">


    47:       <%= yield %>


    48:     </div>


    49:     <%= shared_component('footer', :static) %>


    50:     <!-- after footer -->



/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/unicorn-4.3.1.2/lib/unicorn/http_response.rb:41:in
`write'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/unicorn-4.3.1.2/lib/unicorn/http_response.rb:41:in
`block in http_response_write'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:523:in
`block in each'


/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/chunked.rb:28:in
`block in each'


/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_view/buffers.rb:31:in
`call'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_view/buffers.rb:31:in
`safe_concat'
  /home/dan/dev/skweb/app/views/layouts/application.html.erb:47:in
`_app_views_layouts_application_html_erb__3293108995857455051_100497760'


/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_view/template.rb:145:in
`block in render'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications.rb:125:in
`instrument'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_view/template.rb:143:in
`render'

/home/dan/dev/skweb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_view/renderer/streaming_template_renderer.rb:73:in
`block (2 levels) in delayed_render'
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.