堆栈级别太深:Spree 管理员 - 产品图片

Stack Level Too Deep: Spree Admin - Product Images

我在 spree 2.3.0 的生产环境中遇到 Stack Level Too Deep 错误。

当我尝试转到管理面板中的产品图片索引页面时发生。此错误不会发生在开发中,只会发生在 Ninefold 的生产中。当我在生产模式下本地 运行 应用程序时,不会发生错误。我似乎可以追踪是什么原因造成的。我没有更改 Spree 中与产品图片相关的任何默认核心功能。图像在前端渲染良好。

我正在使用回形针和 aws。有一次生产没有错误。但是,我检查了我所有的提交,但无法查明导致此问题的更改。我已经添加了其他 gems,但是 none 的 gems 与回形针 gems 或其依赖项发生冲突,这是我对可能导致此问题的猜测。

这里是生产日志错误。

+0000
I, [2015-01-11T22:02:28.691119 #26116] INFO -- : Processing by Spree::Admin::ImagesController#index as HTML
I, [2015-01-11T22:02:28.691252 #26116] INFO -- : Parameters: {"product_id"=>"black-string-tie-halter-top-with-printed-neck-binding"}
D, [2015-01-11T22:02:28.693443 #26116] DEBUG -- : Cache read: spree/app_configuration/redirect_https_to_http
D, [2015-01-11T22:02:28.693920 #26116] DEBUG -- : Cache read: spree/backend_configuration/locale
D, [2015-01-11T22:02:28.695806 #26116] DEBUG -- : [1m[36mSpree::Preference Load (0.7ms)[0m [1mSELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = 'spree/backend_configuration/locale' LIMIT 1[0m
D, [2015-01-11T22:02:28.695979 #26116] DEBUG -- : Cache write: spree/backend_configuration/locale
D, [2015-01-11T22:02:28.696566 #26116] DEBUG -- : Cache read: spree/app_configuration/allow_ssl_in_production
D, [2015-01-11T22:02:28.696881 #26116] DEBUG -- : Cache read: spree/app_configuration/check_for_spree_alerts
D, [2015-01-11T22:02:28.697171 #26116] DEBUG -- : Cache read: spree/app_configuration/last_check_for_spree_alerts
D, [2015-01-11T22:02:28.699099 #26116] DEBUG -- : [1m[35mSpree::User Load (0.5ms)[0m SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."id" = 1 ORDER BY "spree_users"."id" ASC LIMIT 1
D, [2015-01-11T22:02:28.702026 #26116] DEBUG -- : [1m[36m (0.5ms)[0m [1mSELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" =  AND "spree_roles"."name" = 'admin'[0m [["user_id", 1]]
I, [2015-01-11T22:02:28.706068 #26116] INFO -- : Completed 500 Internal Server Error in 15ms
F, [2015-01-11T22:02:28.706732 #26116] FATAL -- : 
SystemStackError (stack level too deep):
vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:629

如有任何帮助,我们将不胜感激!

更新 - 生产环境中的完整堆栈跟踪:

SystemStackError in Spree::Admin::ImagesController#index
stack level too deep

Rails.root: /var/www/apps/11829/releases/dbeebbeebaf8ac5fa580e0fd192ad9fc06e7ce4b

Application Trace | Framework Trace | Full Trace
vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:629

所以在检查了我安装的所有 gem 之后,我终于找到了问题所在。

Spree::Admin::ImagesController 装饰器中的 alias_method 导致了 Stack Level Too Deep 错误。