Description of problem: Accessing the 'indirect_service_children' and 'indirect_vms' associations of an MiqAeServiceService object give stack traces Version-Release number of selected component (if applicable): 5.6.0.7-beta2.6.20160516171555_b1be31f How reproducible: Every time Steps to Reproduce: 1. Create a service object 2. Access the 'indirect_service_children' and 'indirect_vms' associations of the serice object Actual results: rb(main):014:0> service.associations => ["all_service_children", "direct_service_children", "direct_vms", "indirect_service_children", "indirect_vms", "parent_service", "root_service", "service_resources", "service_template", "tenant", "vms"] irb(main):015:0> service.indirect_service_children PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0 Ancestry::AncestryException: Named scope 'from_depth' is only available when depth caching is enabled. from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/has_ancestry.rb:72:in `block (2 levels) in has_ancestry' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `instance_exec' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `block (2 levels) in scope' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation.rb:351:in `scoping' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `block in scope' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:13:in `block in scope_depth' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `each' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `inject' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `scope_depth' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation/delegation.rb:88:in `public_send' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation/delegation.rb:88:in `block in method_missing' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation.rb:351:in `scoping' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation/delegation.rb:88:in `method_missing' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/instance_methods.rb:241:in `descendants' from /var/www/miq/vmdb/app/models/service.rb:84:in `indirect_service_children' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activesupport/lib/active_support/deprecation/method_wrappers.rb:61:in `block (3 levels) in deprecate_methods' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:263:in `block in object_send' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:282:in `ar_method' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:292:in `ar_method' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:261:in `object_send' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:122:in `block (2 levels) in expose' from (irb):15 from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/console.rb:65:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/console_helper.rb:9:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:78:in `console' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'irb(main):016:0> irb(main):017:0* service.direct_service_children PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0 => [] irb(main):018:0> service.indirect_vms PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0 Ancestry::AncestryException: Named scope 'from_depth' is only available when depth caching is enabled. from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/has_ancestry.rb:72:in `block (2 levels) in has_ancestry' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `instance_exec' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `block (2 levels) in scope' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation.rb:351:in `scoping' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/scoping/named.rb:159:in `block in scope' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:13:in `block in scope_depth' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `each' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `inject' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/class_methods.rb:10:in `scope_depth' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation/delegation.rb:64:in `block in scope_depth' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation.rb:351:in `scoping' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activerecord/lib/active_record/relation/delegation.rb:64:in `scope_depth' from /opt/rh/cfme-gemset/gems/ancestry-2.1.0/lib/ancestry/instance_methods.rb:241:in `descendants' from /var/www/miq/vmdb/app/models/service.rb:84:in `indirect_service_children' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activesupport/lib/active_support/deprecation/method_wrappers.rb:61:in `block (3 levels) in deprecate_methods' from /var/www/miq/vmdb/app/models/service.rb:91:in `indirect_vms' from /opt/rh/cfme-gemset/bundler/gems/rails-a44497f6c9ef/activesupport/lib/active_support/deprecation/method_wrappers.rb:61:in `block (3 levels) in deprecate_methods' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:263:in `block in object_send' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:282:in `ar_method' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:292:in `ar_method' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:261:in `object_send' from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:122:in `block (2 levels) in expose' from (irb):18 from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/console.rb:65:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/console_helper.rb:9:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:78:in `console' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /opt/rh/cfme-gemset/gems/railties-5.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'irb(main):019:0> Expected results: No error Additional info:
Peter, I'm working on a fix right now. Curiously, is there a reason you are not using vms? if you are doing direct_vms + indirect_vms, then using vms will be much more performant.
Hi Keenan I found the errors though running object_walker on a service (it walks all service model object associations and optionally prints their details). I just thought I'd better report it as a BZ. Peter
https://github.com/ManageIQ/manageiq/pull/8964
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/b12110608d338e47ecaf3aa3264af415a6a01a66 commit b12110608d338e47ecaf3aa3264af415a6a01a66 Author: Keenan Brock <kbrock> AuthorDate: Wed May 25 12:26:11 2016 -0400 Commit: Keenan Brock <kbrock> CommitDate: Wed May 25 13:07:36 2016 -0400 fix service.indirect_vms indirect_service_children https://bugzilla.redhat.com/show_bug.cgi?id=1339518 app/models/service.rb | 2 +- spec/models/service_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
Verified in 5.6.0.9 irb(main):016:0> srv.indirect_service_children => [] irb(main):017:0> srv.indirect_vms => []
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1348