Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-41513

ForemanInventoryUpload::async::SingleHostReportJob fails with ScopedSearch::QueryNotSupported undefined method `subtree_ids' for nil:NilClass

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.18.1
    • RH Cloud
    • None
    • False
    • sat-proton
    • None
    • None
    • None
    • None

      Environment:

      Satellite 6.18.1 

      IoP enabled

       

      Scenariio:

      An external customer having Satellite 6.18.1 with IoP enabled has 1000+ paused tasks for ForemanInventoryUpload::Async::SingleHostReportJob

       

       

      # sudo su - postgres -c "psql -d foreman -c 'select label,count(label),state,result from foreman_tasks_tasks where state <> '\''stopped'\'' group by label,state,result ORDER BY label;'"
      label | count | state | result
      -------------------------------------------------------------------+--------
      Actions::CheckLongRunningTasks | 1 | scheduled | pending
      Actions::Katello::SyncPlan::Run | 1 | scheduled | pending
      Actions::RemoteExecution::RunHostsJob | 6 | scheduled | pending
      CreateExpiredManifestNotifications | 1 | scheduled | pending
      CreateHostLifecycleExpireSoonNotifications | 1 | scheduled | pending
      CreateManifestExpireSoonWarningNotifications | 1 | scheduled | pending
      CreatePulpDiskSpaceNotifications | 4 | scheduled | pending
      CreateRssNotifications | 1 | scheduled | pending
      ForemanInventoryUpload::Async::GenerateAllReportsJob | 1 | scheduled | pending
      ForemanInventoryUpload::Async::SingleHostReportJob | 1571 | paused | error
      InsightsCloud::Async::InsightsClientStatusAging | 1 | scheduled | pending
      InsightsCloud::Async::InsightsScheduledSync | 1 | scheduled | pending
      InventorySync::Async::InventoryScheduledSync | 1 | scheduled | pending
      SendExpireSoonNotifications | 4 | scheduled | pending
      StoredValuesCleanupJob | 3 | scheduled | pending
       
       
      

      As i understand, this task is triggered in 6.18 whenever a package profile data is being sent from a host to satellite. So the count is understandable. 

       

      But the failure happens in a odd way. Their ForemanInventoryUpload::async::GenerateHostReport step in ForemanInventoryUpload::async::SingleHostReportJob is failing with error

       

      ScopedSearch::QueryNotSupported
      external method 'search_by_params' failed with error: undefined method `subtree_ids' for nil:NilClass
      

      Production.log sgows the following info:

       

      they have only one org and in the task, both organization_id and filter is correctly passed as far as i can see in task export

       

      2025-12-17T07:55:59 [I|bac|4e6893b4] Task {label: ForemanInventoryUpload::Async::SingleHostReportJob, id: d891212c-f80b-4bdc-94b9-01d9e12afe3b, execution_plan_id: fb95ac76-ddc2-4dde-9f5e-bc20ac3a87b1} state changed: running 
      2025-12-17T07:55:59 [I|app|4e6893b4] Started generating hosts report in /tmp/d20251217-1918-ctbldn
      2025-12-17T07:55:59 [E|bac|4e6893b4] external method 'search_by_params' failed with error: undefined method `subtree_ids' for nil:NilClass (ScopedSearch::QueryNotSupported)
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:447:in `rescue in to_ext_method_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:444:in `to_ext_method_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:233:in `sql_test'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:591:in `sql_test'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:538:in `to_single_field_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:550:in `to_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:609:in `to_not_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:544:in `to_sql'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:56:in `build_find_params'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/query_builder.rb:22:in `build_query'
       4e6893b4 | /usr/share/gems/gems/scoped_search-4.2.0/lib/scoped_search/definition.rb:328:in `block in register_named_scope!'
       4e6893b4 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/relation/delegation.rb:67:in `block in search_for'
       4e6893b4 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/relation.rb:881:in `_scoping'
       4e6893b4 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/relation.rb:428:in `scoping'
       4e6893b4 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/relation/delegation.rb:67:in `search_for'
       4e6893b4 | /usr/share/gems/gems/foreman_rh_cloud-12.2.12/lib/foreman_inventory_upload/generators/queries.rb:51:in `for_slice'
       4e6893b4 | /usr/share/gems/gems/foreman_rh_cloud-12.2.12/lib/foreman_inventory_upload/generators/queries.rb:64:in `for_org'
       4e6893b4 | /usr/share/gems/gems/foreman_rh_cloud-12.2.12/lib/foreman_inventory_upload/generators/archived_report.rb:12:in `block in render'
       4e6893b4 | /usr/share/ruby/tmpdir.rb:96:in `mktmpdir'
       4e6893b4 | /usr/share/gems/gems/foreman_rh_cloud-12.2.12/lib/foreman_inventory_upload/generators/archived_report.rb:10:in `render'
       4e6893b4 | /usr/share/gems/gems/foreman_rh_cloud-12.2.12/lib/foreman_inventory_upload/async/generate_host_report.rb:15:in `run'

       

              Unassigned Unassigned
              rhn-support-saydas Sayan Das
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: