Project

General

Profile

Actions

Defect #13449

closed

memcached + i18n Problem

Added by IT Admin Atrada over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
I18n
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I want to change my redmine to use memcached.
I do like http://www.redmineblog.com/page2 and redmine run faster than before.
But when I want to go to "Administration -> Settings" or "My Account" I get an "Redmine error 500".

config/additional_environment.rb

# config/additional_environment.rb
#
config.gem 'memcached' # For other hosts
# config.gem 'memcached-northscale', :lib => 'memcached' # For Heroku.com
require 'memcached'
config.cache_store = :mem_cache_store, ::Memcached::Rails.new('127.0.0.1:1121')

log/production.log
ActionView::Template::Error (Key {"i18n/languages_options"=>"127.0.0.1:1121:8"}):
    3: <div class="box tabular settings">
    4: <p><%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [t.name, t.id]}, :blank => :label_default, :label => :label_theme %></p>
    5:
    6: <p><%= setting_select :default_language, lang_options_for_select(false) %></p>
    7:
    8: <p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %></p>
    9: <% locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>
  lib/redmine/i18n.rb:95:in `languages_options'
  app/helpers/application_helper.rb:975:in `lang_options_for_select'
  app/views/settings/_display.html.erb:6:in `block in _app_views_settings__display_html_erb___1813701505727690650_36871100'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb___1813701505727690650_36871100'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb___2743497495253920682_47075300'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb___2743497495253920682_47075300'
  app/helpers/application_helper.rb:263:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb__3216536329719411937_46993280'
  app/controllers/settings_controller.rb:26:in `index'

Apache error Log
cache error: Key {"https://nbg-dev03/redmine/settings?"=>"127.0.0.1:1121:8"}
/var/lib/gems/1.9.1/gems/memcached-1.5.0/lib/memcached/memcached.rb:630:in `reraise'
/var/lib/gems/1.9.1/gems/memcached-1.5.0/lib/memcached/memcached.rb:608:in `check_return_code'
/var/lib/gems/1.9.1/gems/memcached-1.5.0/lib/memcached/memcached.rb:517:in `get'
/var/lib/gems/1.9.1/gems/memcached-1.5.0/lib/memcached/rails.rb:50:in `get'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb:130:in `read_entry'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:134:in `read_entry'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb:187:in `read_entry'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache.rb:316:in `block in read'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache.rb:520:in `instrument'
/var/lib/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache.rb:315:in `read'
/var/lib/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/http/rack_cache.rb:17:in `read'
/var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/metastore.rb:30:in `lookup'
/var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:169:in `lookup'
/var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
/var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/var/lib/gems/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:479:in `call'
/var/lib/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:223:in `call'
/var/lib/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:470:in `safe_fork'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/var/lib/gems/1.9.1/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99:in `<main>'

Ruby-Version:
Ruby version              1.9.3 (x86_64-linux)
RubyGems version          1.8.11
Rack version              1.4
Rails version             3.2.11
Active Record version     3.2.11
Action Pack version       3.2.11
Active Resource version   3.2.11
Action Mailer version     3.2.11
Active Support version    3.2.11
Middleware                Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000000036076a8>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication
Application root          /var/software/redmine-2.2.2
Environment               production
Database adapter          mysql2
Database schema version   20121026003537

Redmine-Version
Environment:
  Redmine version                          2.2.2.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.11
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  redmine_extended_spent_time              0.0.3
  redmine_favourite_projects               0.6
  redmine_hudson                           1.0.8
  redmine_issue_control_panel              0.3.0
  redmine_lightbox                         0.0.1
  redmine_logs                             0.0.5
  redmine_monitoring_controlling           0.1.1
  redmine_mylyn_connector                  2.8.2.stable
  redmine_wiki_extensions                  0.6.1
  timesheet_plugin                         0.6.0

Actions #1

Updated by Etienne Massip over 11 years ago

Try to clean your cache (rake tmp:cache:clear RAILS_ENV=production or similar)?

Actions #2

Updated by Peter Höpfl over 11 years ago

No, that doesn't help, just tried it out.
To me it looks like the i18n code within lib/redmine/i18n.rb, Line 95 got broken. Obviously this method does not work when you turn on memcached as cache store:

    # The result is cached to prevent from loading all translations files.
    def languages_options
      ActionController::Base.cache_store.fetch "i18n/languages_options" do
        valid_languages.map {|lang| [ll(lang.to_s, :general_lang_name), lang.to_s]}.sort {|x,y| x$
      end
    end

Unfortunately my rails knowledge is too limited to solve this, any idea what goes wrong?

Actions #3

Updated by Etienne Massip over 11 years ago

Try to map Rails's Guide configuration rather thant the old blog one?

Actions #4

Updated by Etienne Massip over 11 years ago

Or use Dalli since it's supposed to replace the memcached-client gem Rails uses by default.

Actions #5

Updated by Peter Höpfl over 11 years ago

Thanks Etienne!
That did it:
Changed config to

config.cache_store = :mem_cache_store, "127.0.0.1:1121" 

and everything works as expected.

I will tell my colleague to close the ticket, maybe you could trigger an update for the blog entry.

:-)

Actions #6

Updated by Etienne Massip over 11 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Peter Höpfl wrote:

maybe you could trigger an update for the blog entry.

I can't but I added his author as watcher if he wants to.

The blog entry is quite old now and was written with Redmine < 2.x so it shouldn't be used as a reference anymore.

Actions

Also available in: Atom PDF