我使用Rails 3.0.7,在某些情况下,WebBrick进入无限循环,增加CPU和内存使用量。为了打破它,我需要kill -9
。它发生在我tried to use active_scaffold时,当我使用ActiveAdmin时发生错误。
奇怪的是,当我在ActiveAdmin中使用默认字段时,确定,但是当我尝试显示照片时(来自paper_clip),它会挂起。列有一个代码:
column "Photo" do
user.photo
end
我尝试在行debugger
之前插入user.photo
,我注意到此循环发生在activesupport-3.0.7/lib/active_support/core_ext/module/introspection.rb:74
。你知道吗,这可能是造成这种奇怪行为的原因吗?
这是我的stacktrace:
(rdb:2) info stack
--> #0 Array.local_constants
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/module/introspection.rb:74
#1 Module.local_constants
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/module/introspection.rb:73
#2 Module.local_constant_names
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/module/introspection.rb:86
#3 Array.watch_namespaces
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:127
#4 ActiveSupport::Dependencies::WatchStack.watch_namespaces(namespaces#Array)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:125
#5 ActiveSupport::Dependencies.new_constants_in
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:592
#6 ActiveSupport::Dependencies::Loadable.load_dependency(file#String)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
#7 ActiveSupport::Dependencies::Loadable.require(file#String)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
#8 at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_view/template/error.rb:1
#9 ActiveSupport::Notifications::Instrumenter._render_template(name#String, payload#Hash,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_view/render/rendering.rb:59
#10 ActiveSupport::Notifications.instrument(name#String, payload#Hash)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52
#11 ActionView::Rendering._render_template(template#ActionView::Template, layout#NilClass,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_view/render/rendering.rb:56
#12 ActionView::Rendering.default(options#Hash, locals#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_view/render/rendering.rb:26
#13 ActiveAdmin::ViewHelpers::RendererHelper.render
at line /var/lib/gems/1.8/gems/activeadmin-0.4.3/lib/active_admin/view_helpers/renderer_helper.rb:23
#14 AbstractController::Rendering._render_template(options#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:115
#15 AbstractController::Rendering.render_to_body(options#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:109
#16 ActionController::Renderers.render_to_body(options#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/renderers.rb:47
#17 ActionController::Compatibility.render_to_body(options#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/compatibility.rb:55
#18 AbstractController::Rendering.render_to_string
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:102
#19 AbstractController::Rendering.render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:93
#20 ActionController::Rendering.render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:17
#21 Benchmark.render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:40
#22 Benchmark.ms
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/benchmark.rb:5
#23 ActionController::Instrumentation.render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:40
#24 ActiveRecord::Railties::ControllerRuntime.cleanup_view_runtime
at line /var/lib/gems/1.8/gems/activerecord-3.0.7/lib/active_record/railties/controller_runtime.rb:15
#25 ActionController::Instrumentation.render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:39
#26 Proc.index
at line /var/lib/gems/1.8/gems/activeadmin-0.4.3/lib/active_admin/resource_controller/actions.rb:13
#27 ActionController::Responder.default_render
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/responder.rb:190
#28 ActionController::Responder.to_html
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/responder.rb:126
#29 Responders::FlashResponder.to_html
at line /var/lib/gems/1.8/gems/responders-0.6.5/lib/responders/flash_responder.rb:93
#30 Kernel.send(method#Symbol)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/responder.rb:119
#31 ActionController::Responder.respond
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/responder.rb:119
#32 ActionController::Responder.new
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/responder.rb:112
#33 ActionController::MimeResponds.delete
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/mime_responds.rb:232
#34 InheritedResources::Actions.<<(options#Hash)
at line /var/lib/gems/1.8/gems/inherited_resources-1.3.1/lib/inherited_resources/actions.rb:7
#35 ActiveAdmin::ResourceController.index(options#Hash)
at line /var/lib/gems/1.8/gems/activeadmin-0.4.3/lib/active_admin/resource_controller/actions.rb:11
#36 Kernel.send_action(method#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5
#37 ActionController::ImplicitRender.send_action(method#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5
#38 AbstractController::Base.process_action(method_name#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150
#39 ActionController::Rendering.process_action
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11
#40 Admin::AnimatorsController.process_action
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18
#41 Kernel.send(key#String)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410
#42 ActiveAdmin::BaseController._run_process_action_callbacks(key#String)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410
#43 Kernel.send(kind#Symbol, args#Array)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94
#44 ActiveSupport::Callbacks.to_s
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94
#45 AbstractController::Callbacks.process_action(method_name#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:17
#46 ActiveSupport::Notifications::Instrumenter.process_action(name#String, payload#Hash,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:30
#47 ActiveSupport::Notifications.instrument(name#String, payload#Hash)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52
#48 ActionController::Instrumentation.process_action(action#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:29
#49 ActionController::Rescue.process_action
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rescue.rb:17
#50 AbstractController::Base.process(action#String)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:119
#51 AbstractController::Rendering.process
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:41
#52 ActionController::Metal.dispatch(name#String, request#ActionDispatch::Request,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:138
#53 ActionController::RackDelegation.dispatch(action#String, request#ActionDispatch::Request,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:14
#54 Proc.new(controller#Class)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:11
#55 ActionDispatch::Routing::RouteSet::Dispatcher.dispatch(controller#Class, action#String,...)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62
#56 ActionDispatch::Routing::RouteSet::Dispatcher.[](env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:27
#57 call(obj#ActionDispatch::Request)
at line /var/lib/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148
#58 recognize(obj#ActionDispatch::Request)
at line /var/lib/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92
#59 Rack::Mount::RouteSet.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139
#60 ActionDispatch::Routing::RouteSet.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:493
#61 Sass::Plugin::Rack.call(env#Hash)
at line /var/lib/gems/1.8/gems/sass-3.1.15/lib/sass/plugin/rack.rb:54
#62 Kernel.call(env#Hash)
at line /var/lib/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:35
#63 Warden::Manager.call(env#Hash)
at line /var/lib/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:34
#64 ActionDispatch::BestStandardsSupport.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/best_standards_support.rb:17
#65 ActionDispatch::Head.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/head.rb:14
#66 Rack::MethodOverride.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/methodoverride.rb:24
#67 ActionDispatch::ParamsParser.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/params_parser.rb:21
#68 ActionDispatch::Flash.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/flash.rb:182
#69 ActionDispatch::Session::AbstractStore.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/session/abstract_store.rb:149
#70 ActionDispatch::Cookies.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/cookies.rb:302
#71 ActiveRecord::ConnectionAdapters::QueryCache.call
at line /var/lib/gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:32
#72 ActiveRecord::QueryCache::ClassMethods.cache
at line /var/lib/gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:12
#73 ActiveRecord::QueryCache.call(env#Hash)
at line /var/lib/gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:31
#74 ActiveRecord::ConnectionAdapters::ConnectionManagement.call(env#Hash)
at line /var/lib/gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:354
#75 ActionDispatch::Callbacks.call(key#NilClass)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:46
#76 ActionDispatch::Callbacks.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:44
#77 Rack::Sendfile.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/sendfile.rb:106
#78 ActionDispatch::RemoteIp.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/remote_ip.rb:48
#79 ActionDispatch::ShowExceptions.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/show_exceptions.rb:47
#80 Rails::Rack::Logger.call(env#Hash)
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/rack/logger.rb:13
#81 Rack::Runtime.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/runtime.rb:17
#82 ActiveSupport::Cache::Strategy::LocalCache.call(env#Hash)
at line /var/lib/gems/1.8/gems/activesupport-3.0.7/lib/active_support/cache/strategy/local_cache.rb:72
#83 Mutex.call at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/lock.rb:13
#84 Rack::Lock.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/lock.rb:13
#85 ActionDispatch::Static.call(env#Hash)
at line /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/static.rb:30
#86 Rails::Application.call(env#Hash)
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:168
#87 Kernel.send(args#Array, block#NilClass)
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77
#88 Rails::Application.method_missing
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77
#89 Rails::Rack::Debugger.call(env#Hash)
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/rack/debugger.rb:21
#90 Rails::Rack::LogTailer.call(env#Hash)
at line /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:14
#91 Rack::ContentLength.call(env#Hash)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/content_length.rb:13
#92 Rack::Handler::WEBrick.service(req#WEBrick::HTTPRequest, res#WEBrick::HTTPResponse,...)
at line /var/lib/gems/1.8/gems/rack-1.2.5/lib/rack/handler/webrick.rb:52
#93 WEBrick::HTTPServer.service(req#WEBrick::HTTPRequest, res#WEBrick::HTTPResponse,...)
at line /usr/lib/ruby/1.8/webrick/httpserver.rb:104
#94 WEBrick::HTTPServer.run(sock#TCPSocket)
at line /usr/lib/ruby/1.8/webrick/httpserver.rb:65
#95 WEBrick::GenericServer.start_thread(sock#TCPSocket)
at line /usr/lib/ruby/1.8/webrick/server.rb:173
答案 0 :(得分:0)
问题是我忘了传递一个块变量。我相信Active Admin应该引发错误而不是查找不存在的变量。正确的版本是:
column "Photo" do user
user.photo
end