vendredi 21 août 2015

incompatible character encodings: UTF-8 and ASCII-8BIT in Rails 3.2

In production, my logs report occasional:

ActionView::Template::Error: incompatible character encodings: UTF-8 and ASCII-8BIT

errors at the following URL for example:

http://ift.tt/1gZYaM8

However, I can't reproduce the issue on my side. The page loads just fine. I have set my Rails app to UTF8 and I use mysql2 gem. I'm on:

Ruby 2.0 Rails 3.2.22

Full trace:

…22/lib/active_support/core_ext/string/
output_safety.rb: 135:in `concat'
…22/lib/active_support/core_ext/string/
output_safety.rb: 135:in `concat'
….0.0/gems/actionpack-3.2.22/lib/action_view/
buffers.rb:  11:in `<<'
/home/mycourse/MyCourseWalk/app/views/layouts/portal.html.erb:211:in `_app_views_layouts_portal_html_erb__471610436674289110_34737560'
…0.0/gems/actionpack-3.2.22/lib/action_view/
template.rb: 145:in `block in render'
…tivesupport-3.2.22/lib/active_support/
notifications.rb: 125:in `instrument'
…0.0/gems/actionpack-3.2.22/lib/action_view/
template.rb: 143:in `render'
…k-3.2.22/lib/action_view/renderer/
template_renderer.rb:  59:in `render_with_layout'
…k-3.2.22/lib/action_view/renderer/
template_renderer.rb:  45:in `render_template'
…k-3.2.22/lib/action_view/renderer/
template_renderer.rb:  18:in `render'
…actionpack-3.2.22/lib/action_view/renderer/
renderer.rb:  36:in `render_template'
…actionpack-3.2.22/lib/action_view/renderer/
renderer.rb:  17:in `render'
…actionpack-3.2.22/lib/abstract_controller/
rendering.rb: 110:in `_render_template'
…onpack-3.2.22/lib/action_controller/metal/
streaming.rb: 225:in `_render_template'
…actionpack-3.2.22/lib/abstract_controller/
rendering.rb: 103:in `render_to_body'
…onpack-3.2.22/lib/action_controller/metal/
renderers.rb:  28:in `render_to_body'
…ck-3.2.22/lib/action_controller/metal/
compatibility.rb:  50:in `render_to_body'
…actionpack-3.2.22/lib/abstract_controller/
rendering.rb:  88:in `render'
…onpack-3.2.22/lib/action_controller/metal/
rendering.rb:  16:in `render'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  40:in `block (2 levels) in render'
…upport-3.2.22/lib/active_support/core_ext/
benchmark.rb:   5:in `block in ms'
        /usr/local/ruby20/lib64/ruby/2.0.0/
benchmark.rb: 296:in `realtime'
…upport-3.2.22/lib/active_support/core_ext/
benchmark.rb:   5:in `ms'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  40:in `block in render'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  83:in `cleanup_view_runtime'
….2.22/lib/active_record/railties/
controller_runtime.rb:  24:in `cleanup_view_runtime'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  39:in `render'
…-3.2.22/lib/action_controller/metal/
implicit_render.rb:  10:in `default_render'
…-3.2.22/lib/action_controller/metal/
implicit_render.rb:   5:in `send_action'
…gems/actionpack-3.2.22/lib/abstract_controller/
base.rb: 167:in `process_action'
…onpack-3.2.22/lib/action_controller/metal/
rendering.rb:  10:in `process_action'
…actionpack-3.2.22/lib/abstract_controller/
callbacks.rb:  18:in `block in process_action'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 458:in `_run__1010317491894699578__process_action__1264968822809274943__callbacks'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 405:in `__run_callback'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 385:in `_run_process_action_callbacks'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb:  81:in `run_callbacks'
…actionpack-3.2.22/lib/abstract_controller/
callbacks.rb:  17:in `process_action'
…ctionpack-3.2.22/lib/action_controller/metal/
rescue.rb:  29:in `process_action'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  30:in `block in process_action'
…tivesupport-3.2.22/lib/active_support/
notifications.rb: 123:in `block in instrument'
….2.22/lib/active_support/notifications/
instrumenter.rb:  20:in `instrument'
…tivesupport-3.2.22/lib/active_support/
notifications.rb: 123:in `instrument'
…-3.2.22/lib/action_controller/metal/
instrumentation.rb:  29:in `process_action'
…k-3.2.22/lib/action_controller/metal/
params_wrapper.rb: 207:in `process_action'
….2.22/lib/active_record/railties/
controller_runtime.rb:  18:in `process_action'
…gems/actionpack-3.2.22/lib/abstract_controller/
base.rb: 121:in `process'
…actionpack-3.2.22/lib/abstract_controller/
rendering.rb:  45:in `process'
…/gems/actionpack-3.2.22/lib/action_controller/
metal.rb: 203:in `dispatch'
…-3.2.22/lib/action_controller/metal/
rack_delegation.rb:  14:in `dispatch'
…/gems/actionpack-3.2.22/lib/action_controller/
metal.rb: 246:in `block in action'
…onpack-3.2.22/lib/action_dispatch/routing/
route_set.rb:  73:in `call'
…onpack-3.2.22/lib/action_dispatch/routing/
route_set.rb:  73:in `dispatch'
…onpack-3.2.22/lib/action_dispatch/routing/
route_set.rb:  36:in `call'
…le/ruby/2.0.0/gems/journey-1.0.4/lib/journey/
router.rb:  68:in `block in call'
…le/ruby/2.0.0/gems/journey-1.0.4/lib/journey/
router.rb:  56:in `each'
…le/ruby/2.0.0/gems/journey-1.0.4/lib/journey/
router.rb:  56:in `call'
…onpack-3.2.22/lib/action_dispatch/routing/
route_set.rb: 608:in `call'
…b/action_dispatch/middleware/
best_standards_support.rb:  17:in `call'
…dor/bundle/ruby/2.0.0/gems/rack-1.4.7/lib/rack/
etag.rb:  23:in `call'
…/ruby/2.0.0/gems/rack-1.4.7/lib/rack/
conditionalget.rb:  25:in `call'
…tionpack-3.2.22/lib/action_dispatch/middleware/
head.rb:  14:in `call'
…3.2.22/lib/action_dispatch/middleware/
params_parser.rb:  21:in `call'
…ionpack-3.2.22/lib/action_dispatch/middleware/
flash.rb: 242:in `call'
…/2.0.0/gems/rack-1.4.7/lib/rack/session/abstract/
id.rb: 210:in `context'
…/2.0.0/gems/rack-1.4.7/lib/rack/session/abstract/
id.rb: 205:in `call'
…npack-3.2.22/lib/action_dispatch/middleware/
cookies.rb: 341:in `call'
…s/activerecord-3.2.22/lib/active_record/
query_cache.rb:  64:in `call'
…record/connection_adapters/abstract/
connection_pool.rb: 479:in `call'
…ack-3.2.22/lib/action_dispatch/middleware/
callbacks.rb:  28:in `block in call'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 405:in `_run__3408719262216010775__call__2164579995344004__callbacks'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 405:in `__run_callback'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb: 385:in `_run_call_callbacks'
…s/activesupport-3.2.22/lib/active_support/
callbacks.rb:  81:in `run_callbacks'
…ack-3.2.22/lib/action_dispatch/middleware/
callbacks.rb:  27:in `call'
…ack-3.2.22/lib/action_dispatch/middleware/
remote_ip.rb:  31:in `call'
….22/lib/action_dispatch/middleware/
debug_exceptions.rb:  16:in `call'
…2.22/lib/action_dispatch/middleware/
show_exceptions.rb:  56:in `call'
…by/2.0.0/gems/railties-3.2.22/lib/rails/rack/
logger.rb:  32:in `call_app'
…by/2.0.0/gems/railties-3.2.22/lib/rails/rack/
logger.rb:  16:in `block in call'
…ivesupport-3.2.22/lib/active_support/
tagged_logging.rb:  22:in `tagged'
…by/2.0.0/gems/railties-3.2.22/lib/rails/rack/
logger.rb:  16:in `call'
…ck-3.2.22/lib/action_dispatch/middleware/
request_id.rb:  22:in `call'
…/ruby/2.0.0/gems/rack-1.4.7/lib/rack/
methodoverride.rb:  21:in `call'
…/bundle/ruby/2.0.0/gems/rack-1.4.7/lib/rack/
runtime.rb:  17:in `call'
….2.22/lib/active_support/cache/strategy/
local_cache.rb:  72:in `call'
…dor/bundle/ruby/2.0.0/gems/rack-1.4.7/lib/rack/
lock.rb:  15:in `call'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/
context.rb: 136:in `forward'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/
context.rb: 245:in `fetch'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/
context.rb: 185:in `lookup'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/
context.rb:  66:in `call!'
…by/2.0.0/gems/rack-cache-1.2/lib/rack/cache/
context.rb:  51:in `call'
…le/ruby/2.0.0/gems/railties-3.2.22/lib/rails/
engine.rb: 484:in `call'
…by/2.0.0/gems/railties-3.2.22/lib/rails/
application.rb: 231:in `call'
…gems/railties-3.2.22/lib/rails/railtie/
configurable.rb:  30:in `method_missing'
…lib/phusion_passenger/rack/
thread_handler_extension.rb:  77:in `process_request'
…ib/phusion_passenger/request_handler/
thread_handler.rb: 142:in `accept_and_process_next_request'
…ib/phusion_passenger/request_handler/
thread_handler.rb: 110:in `main_loop'
…senger-4.0.38/lib/phusion_passenger/
request_handler.rb: 448:in `block (3 levels) in start_threads'

Aucun commentaire:

Enregistrer un commentaire