0

我有一堆我试图每隔几秒钟更新一次的对象。每隔一段时间,我正在轮询的应该返回 @array.to_json 的操作就会因该错误而死 - 参数数量错误(0 代表 2)

我已经看到某些包含 Rails 内部使用的属性的对象可能会发生这种情况,但我找不到任何可疑的东西

数据样本:

{"prop": {"match_id": 4295119908, "title": "Draw", "status": 1, "prop_type_id": 36, "market_id": 111363650, "id": 127503900, "source": 1, "selection_id": 58805, "odds": 1.52}}

奇怪的是,它并非一直都在发生。如果我多次刷新页面,则 5 或 10 个请求中只有一个失败。

有人可以帮忙吗?是否还有其他可能导致此错误的原因?

TIA

完整错误:

    /opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:75:in `[]='
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:75:in `send'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:75:in `serializable_record'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:75:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:75:in `serializable_record'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/object/misc.rb:39:in `returning'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:74:in `serializable_record'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serializers/json_serializer.rb:70:in `serialize'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serialization.rb:91:in `to_s'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/serializers/json_serializer.rb:57:in `to_json'
app/views/props/load_props2.html.erb:46
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in `send'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/template.rb:73:in `render_template'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:256:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1174:in `render_for_file'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:896:in `render_without_benchmark'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:868:in `render_without_benchmark'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in `render'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1248:in `default_render'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1254:in `perform_action_without_filters'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in `call_filters'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:in `perform_action_without_caching'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in `passenger_orig_perform_action'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/opt/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in `cache'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:in `passenger_orig_perform_action'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/request_handler.rb:66:in `perform_action'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `send'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `process_without_filters'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in `process'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in `process'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in `handle_request'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
/opt/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/request_handler.rb:51:in `process_request'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:470:in `safe_fork'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99

代码(第 45 行)是

@propz.to_json

@propz 是如上所述的数据数组

4

0 回答 0