Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将3.12升级到4,运行rails s,在本地缓存中间件中获取堆栈级别太深错误_Ruby On Rails - Fatal编程技术网

Ruby on rails 将3.12升级到4,运行rails s,在本地缓存中间件中获取堆栈级别太深错误

Ruby on rails 将3.12升级到4,运行rails s,在本地缓存中间件中获取堆栈级别太深错误,ruby-on-rails,Ruby On Rails,使用了rake rails:update,精心更新了被覆盖的文件,并使我的rspec规范运行为绿色。但是当我运行rails s时,我发现: Unexpected error while processing request: stack level too deep /Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/cache/strategy/local_cache_middlew

使用了
rake rails:update
,精心更新了被覆盖的文件,并使我的rspec规范运行为绿色。但是当我运行
rails s
时,我发现:

Unexpected error while processing request: stack level too deep
/Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:33
具体地说,它是在上面引用的文件中的
response=@app.call(env)
(第26行)处抛出的


我正在查看检查表,看看是否遗漏了某个配置设置。有人能给我一个线索吗?

所以,我做的第一件事是通过添加以下内容从异常中获得完整的回溯:

      rescue Exception => e
        puts e.backtrace
        LocalCacheRegistry.set_cache_for(local_cache_key, nil)
        raise
      end
然后在缓存中间件之前显示了一条关键线,我以前看到过:

/Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/logger.rb:38
Unexpected error while processing request: stack level too deep
/Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:35
我跳进了下面列出的一行:

    define_method(:level=) do |level|
      logger.level = level
      super(level)
    end
然后搜索我的repo的其余部分,查看我触摸的位置
logger.level
。(如果我没有这样找到调用,我会使用
Kernel#caller
)啊哈,我发现:
config/initializers/quiet\u assets.rb
,这是什么?看起来像是我很久以前放在初始化器中的猴子补丁:

# taken from https://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
if Rails.env.development?
  Rails.application.assets.logger = Logger.new('/dev/null')
  Rails::Rack::Logger.class_eval do
    def call_with_quiet_assets(env)
      previous_level = Rails.logger.level
      Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
      call_without_quiet_assets(env)
    ensure
      Rails.logger.level = previous_level
    end
    alias_method_chain :call, :quiet_assets
  end
end

当我把这个注释掉后,我的错误消失了,我可以在浏览器中加载一个页面。现在我已经删除了初始值设定项,可以开始了。:)对于那些使用过的,请确保在升级时将其删除

所以,我做的第一件事是通过添加以下内容从异常中获得完整的回溯:

      rescue Exception => e
        puts e.backtrace
        LocalCacheRegistry.set_cache_for(local_cache_key, nil)
        raise
      end
然后在缓存中间件之前显示了一条关键线,我以前看到过:

/Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/logger.rb:38
Unexpected error while processing request: stack level too deep
/Users/Alex/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:35
我跳进了下面列出的一行:

    define_method(:level=) do |level|
      logger.level = level
      super(level)
    end
然后搜索我的repo的其余部分,查看我触摸的位置
logger.level
。(如果我没有这样找到调用,我会使用
Kernel#caller
)啊哈,我发现:
config/initializers/quiet\u assets.rb
,这是什么?看起来像是我很久以前放在初始化器中的猴子补丁:

# taken from https://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
if Rails.env.development?
  Rails.application.assets.logger = Logger.new('/dev/null')
  Rails::Rack::Logger.class_eval do
    def call_with_quiet_assets(env)
      previous_level = Rails.logger.level
      Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
      call_without_quiet_assets(env)
    ensure
      Rails.logger.level = previous_level
    end
    alias_method_chain :call, :quiet_assets
  end
end
当我把这个注释掉后,我的错误消失了,我可以在浏览器中加载一个页面。现在我已经删除了初始值设定项,可以开始了。:)对于那些使用过的,请确保在升级时将其删除