Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate replacing require_relative with require_dependency #418

Open
gmcculloug opened this issue Feb 5, 2020 · 8 comments
Open

Investigate replacing require_relative with require_dependency #418

gmcculloug opened this issue Feb 5, 2020 · 8 comments

Comments

@gmcculloug
Copy link
Member

Based on work from #415 Guard against hitting const_missing from within const_missing

See #415 (comment)

@skateman
Copy link
Member

Before code reload:
Screenshot from 2020-03-13 12-44-04

After code reload:
Screenshot from 2020-03-13 12-45-29

This is just a demonstration how the automation results are altered after a code reload. It's nearly impossible to do any work in the area 😕

@jrafanie
Copy link
Member

I'm looking at this now as the issue in #415 (comment) indicates the reloading of code in dev mode isn't properly reloading MiqAeServiceModelBase

@jrafanie
Copy link
Member

@pkomanek I'm going to do some testing here and let you know what I find. So far, it looks like either the #415 change was incomplete OR that when rails reloads code, it fails to load it correctly, or both.

Either way, after reload MiqAeServiceModelBase doesn't contain create_service_model_from_name method, so it blows up:

[----] I, [2020-03-13T18:09:14.247656 #83183:3fc8c875e3f8]  INFO -- : XXX: convert_value_based_on_datatype 1 "MiqServer"
[----] I, [2020-03-13T18:09:14.252759 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 1 name: :MiqAeServiceMiqServer
[----] I, [2020-03-13T18:09:14.252843 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 2 defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-13T18:09:14.252879 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 3
[----] I, [2020-03-13T18:09:14.252911 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 1 name: :MiqAeServiceModelBase
[----] I, [2020-03-13T18:09:14.252942 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 2 defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-13T18:09:14.257185 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 1 name: :MiqAeServiceObjectCommon
[----] I, [2020-03-13T18:09:14.257267 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 2 defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-13T18:09:14.257303 #83183:3fc8c875e3f8]  INFO -- : XXX const_missing 3

==> log/evm.log <==
[----] E, [2020-03-13T18:09:14.261608 #83183:3fc8c875e3f8] ERROR -- : [NoMethodError]: undefined method `create_service_model_from_name' for MiqAeMethodService::MiqAeServiceModelBase:Class  Method:[rescue in values_from_automate]

@jrafanie
Copy link
Member

jrafanie commented Mar 24, 2020

@gmcculloug this is as far as @d-m-u and I could get:

master...jrafanie:try_to_support_dev_reload_in_automate

Personally, I think much of the difficulty is that the service models aren't in their own namespace. Because of this, we had to do horrible things like this whitelist of constants within the MiqAeMethodService namespace that were not service models: https://github.com/jrafanie/manageiq-automation_engine/blob/299bf01a5d2c002f20840f71d954c090136d8ff3/lib/miq_automation_engine/engine/miq_ae_method_service.rb#L9-L23

I believe we want const_missing to only pick up service models and unfortunately, that doesn't work correctly currently because we have a mixture of service models and non-service models that could hit const_missing. The solution there would be to have service model namespace with rails convention directories and only have the const_missing there. These whitelisted classes would not be in this namespace, so they would not hit const_missing.

Note, we then tried to use require_dependency in that branch above but again, because we don't have proper directory structures or namespaces, I couldn't just use the constant name and rely on autoload, I had to use require_dependency.

Finally, even with the changes above, I still cannot get development mode reload working for automate and feel it's too big of a project to do on the side.

Note, @d-m-u helped me get this recreated in development mode in rails console using this script below:

Restore the mbu database.

Note, we found that this is the ruby method that was returning empty and what we converted to the code below:

https://github.com/ManageIQ/manageiq-content/blob/d395ff742fac952cdaedb23044a3833390276709/content/automate/ManageIQ/Cloud/Orchestration/Operations/Methods.class/__methods__/available_resource_groups.rb#L21-L25

Start rails server in dev mode in one terminal

Start In rails console in another terminal:

User

$evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)

service = $evm.vmdb(:service_template).find(8)

rs_groups = service.try(:orchestration_manager).try(:resource_groups); nil
puts rs_groups.length

rs_list = {}
rs_groups.each { |rs| rs_list[rs.name] = rs.name } if rs_groups

puts rs_list.inspect


puts defined?(MiqAeMethodService::MiqAeServiceModelBase)

puts MiqAeMethodService::MiqAeServiceModelBase.methods.grep(/create_service_model_from_name/).inspect

Now, make a change to a controller/ui file in manageiq-api

reload!

Now try to run the large block of code above again.

@jrafanie
Copy link
Member

cc @pkomanek see above ^

@jrafanie
Copy link
Member

jrafanie commented Mar 24, 2020

Note, here is where we got to... after reload! in the script above + running the first few lines again:

[----] E, [2020-03-19T17:14:09.642370 #79659:3fcedb82e008] ERROR -- : MiqAeServiceModelBase.ar_method raised: <SystemStackError>: <stack level too deep>
[----] E, [2020-03-19T17:14:09.650976 #79659:3fcedb82e008] ERROR -- : /Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/core_ext/string/filters.rb:65:in `dup'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/core_ext/string/filters.rb:65:in `truncate'
/Users/joerafaniello/.gem/ruby/2.6.5/bundler/gems/manageiq-gems-pending-e7f7d26f726a/lib/gems/pending/util/vmdb-logger.rb:163:in `call'
/Users/joerafaniello/.rubies/ruby-2.6.5/lib/ruby/2.6.0/logger.rb:582:in `format_message'
/Users/joerafaniello/.rubies/ruby-2.6.5/lib/ruby/2.6.0/logger.rb:472:in `add'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activerecord-session_store-1.1.3/lib/active_record/session_store/extension/logger_silencer.rb:38:in `add_with_threadsafety'
/Users/joerafaniello/.rubies/ruby-2.6.5/lib/ruby/2.6.0/logger.rb:525:in `info'
/Users/joerafaniello/Code/manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service.rb:3:in `const_missing'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:271:in `const_get'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:271:in `block in constantize'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `each'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `inject'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `constantize'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
/Users/joerafaniello/Code/manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:126:in `create_service_model'
/Users/joerafaniello/Code/manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:119:in `create_service_model_from_name'
/Users/joerafaniello/Code/manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service.rb:27:in `const_missing'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:271:in `const_get'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:271:in `block in constantize'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `each'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `inject'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `constantize'
/Users/joerafaniello/.gem/ruby/2.6.5/gems/activesupport-5.1.7/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
...

The logging of constants show this:

[----] I, [2020-03-19T17:23:00.900773 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceservice_template
[----] I, [2020-03-19T17:23:00.900870 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:00.900912 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:00.900952 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceservice_template
[----] I, [2020-03-19T17:23:00.900985 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceservice_template
[----] I, [2020-03-19T17:23:00.901090 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: service::template
[----] I, [2020-03-19T17:23:00.901217 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:23:00.901261 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:00.901293 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:00.901324 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:23:00.901358 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:23:00.901393 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:23:03.163162 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplateOrchestration
[----] I, [2020-03-19T17:23:03.163217 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:03.163314 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:03.163387 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplateOrchestration
[----] I, [2020-03-19T17:23:03.163449 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplateOrchestration
[----] I, [2020-03-19T17:23:03.163552 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplateOrchestration
[----] I, [2020-03-19T17:23:07.041379 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceManageIQ_Providers_Azure_CloudManager
[----] I, [2020-03-19T17:23:07.041504 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.041560 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.041614 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceManageIQ_Providers_Azure_CloudManager
[----] I, [2020-03-19T17:23:07.041720 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceManageIQ_Providers_Azure_CloudManager
[----] I, [2020-03-19T17:23:07.041790 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ManageIQ::Providers::Azure::CloudManager
[----] I, [2020-03-19T17:23:07.042138 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceManageIQ_Providers_CloudManager
[----] I, [2020-03-19T17:23:07.042287 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.042352 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.042418 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceManageIQ_Providers_CloudManager
[----] I, [2020-03-19T17:23:07.042470 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceManageIQ_Providers_CloudManager
[----] I, [2020-03-19T17:23:07.042556 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ManageIQ::Providers::CloudManager
[----] I, [2020-03-19T17:23:07.044589 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceManageIQ_Providers_BaseManager
[----] I, [2020-03-19T17:23:07.044759 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.044862 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.044931 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceManageIQ_Providers_BaseManager
[----] I, [2020-03-19T17:23:07.045032 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceManageIQ_Providers_BaseManager
[----] I, [2020-03-19T17:23:07.045104 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ManageIQ::Providers::BaseManager
[----] I, [2020-03-19T17:23:07.045404 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceExtManagementSystem
[----] I, [2020-03-19T17:23:07.045460 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.045508 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.045555 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceExtManagementSystem
[----] I, [2020-03-19T17:23:07.045601 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceExtManagementSystem
[----] I, [2020-03-19T17:23:07.045653 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ExtManagementSystem
[----] I, [2020-03-19T17:23:07.119383 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceManageIQ_Providers_Azure_ResourceGroup
[----] I, [2020-03-19T17:23:07.119448 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.119481 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.119515 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceManageIQ_Providers_Azure_ResourceGroup
[----] I, [2020-03-19T17:23:07.119546 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceManageIQ_Providers_Azure_ResourceGroup
[----] I, [2020-03-19T17:23:07.119584 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ManageIQ::Providers::Azure::ResourceGroup
[----] I, [2020-03-19T17:23:07.119756 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceResourceGroup
[----] I, [2020-03-19T17:23:07.119799 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:23:07.119830 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:23:07.119861 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceResourceGroup
[----] I, [2020-03-19T17:23:07.119889 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceResourceGroup
[----] I, [2020-03-19T17:23:07.119921 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ResourceGroup
[----] I, [2020-03-19T17:24:35.724122 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeService
[----] I, [2020-03-19T17:24:35.724324 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.724387 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.728875 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceModelLegacy
[----] I, [2020-03-19T17:24:35.729008 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.729075 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.730344 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceVmdb
[----] I, [2020-03-19T17:24:35.730403 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.730444 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.731519 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceRbac
[----] I, [2020-03-19T17:24:35.731613 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.731677 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.735450 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceservice_template
[----] I, [2020-03-19T17:24:35.735554 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.735613 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.735664 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceModelBase
[----] I, [2020-03-19T17:24:35.735704 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.735814 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): nil
[----] I, [2020-03-19T17:24:35.740249 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceObjectCommon
[----] I, [2020-03-19T17:24:35.740340 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.740388 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.741784 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceservice_template
[----] I, [2020-03-19T17:24:35.741862 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceservice_template
[----] I, [2020-03-19T17:24:35.741958 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: service::template
[----] I, [2020-03-19T17:24:35.742147 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.742199 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.742245 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.742289 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.742322 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.742365 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:24:35.797892 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798009 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.798049 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.798084 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798115 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798152 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:24:35.798263 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798323 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.798387 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.798426 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798457 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798495 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:24:35.798614 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798659 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.798748 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.798815 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798863 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.798911 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:24:35.799050 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.799091 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.799122 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.799154 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.799184 #79859:3fe97602e014]  INFO -- : XXX create_service_model_from_name 10 name: MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.799218 #79859:3fe97602e014]  INFO -- : XXX service_model_name_to_model 11 ar_model_name: ServiceTemplate
[----] I, [2020-03-19T17:24:35.799321 #79859:3fe97602e014]  INFO -- : XXX const_missing 1 name: :MiqAeServiceServiceTemplate
[----] I, [2020-03-19T17:24:35.799359 #79859:3fe97602e014]  INFO -- : XXX const_missing 2a defined?(MiqAeMethodService): "constant"
[----] I, [2020-03-19T17:24:35.799390 #79859:3fe97602e014]  INFO -- : XXX const_missing 2b defined?(MiqAeServiceModelBase): "constant"
[----] I, [2020-03-19T17:24:35.799421 #79859:3fe97602e014]  INFO -- : XXX const_missing 3a calling create_service_model_from_name MiqAeServiceServiceTemplate
... 
# it keeps doing MiqAeServiceServiceTemplate forever....

I believe it's getting "stuck" here:

model_name_from_active_record_model(ar_model).safe_constantize

@Fryguy
Copy link
Member

Fryguy commented Mar 24, 2020

@jrafanie It sounds like the real problem is that .const_missing is defined at MiqAeServiceModel layer, but other classes that are not directly models (i.e. your horrible list) are also in that space causing a collision. We may not be able to change the namespace of the actual models (because that hierarchy might be in customer methods?), but we can possible re-namespace the rest.

@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2023

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@Fryguy Fryguy removed the stale label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants