Bug 1339518 - Accessing the 'indirect_service_children' and 'indirect_vms' associations of an MiqAeServiceService object raise Ancestry::AncestryException
Summary: Accessing the 'indirect_service_children' and 'indirect_vms' associations of ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: GA
: 5.6.0
Assignee: Keenan Brock
QA Contact: Dmitry Misharov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-25 08:51 UTC by Peter McGowan
Modified: 2018-06-25 14:54 UTC (History)
10 users (show)

Fixed In Version: 5.6.0.9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-29 16:05:36 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1348 0 normal SHIPPED_LIVE CFME 5.6.0 bug fixes and enhancement update 2016-06-29 18:50:04 UTC

Description Peter McGowan 2016-05-25 08:51:00 UTC
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:

Comment 2 Keenan Brock 2016-05-25 16:18:58 UTC
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.

Comment 3 Peter McGowan 2016-05-25 16:25:13 UTC
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

Comment 5 CFME Bot 2016-05-25 18:15:30 UTC
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(-)

Comment 6 Milan Falešník 2016-06-02 10:23:53 UTC
Verified in 5.6.0.9

irb(main):016:0> srv.indirect_service_children
=> []
irb(main):017:0> srv.indirect_vms
=> []

Comment 8 errata-xmlrpc 2016-06-29 16:05:36 UTC
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


Note You need to log in before you can comment on or make changes to this bug.