-
Bug
-
Resolution: Unresolved
-
Major
-
6.18.0, 6.18.1, 6.18.2, 6.18.3
-
2
-
False
-
Proton Sprint 10
-
sat-proton
-
None
-
None
-
None
-
Manual
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'
Steps to Reproduce:
- Have an IoP-enabled Satellite 6.18
- Create a Hostgroup and make sure it inherits the parameters host_registration_insights_inventory and host_registration_insights from Global Parameters.
- Either set the value of host_registration_insights_inventory to false in global parameters or else set the value of the param host_registration_insights_inventory to false in Hostgroup
- Now, register a system with satellite and connect to this host
- Run "dnf uploadprofile --force-upload" on the host
And the error would be reproduced
Now, The error can happen even under this situation i.e. We have two HGs.
HG1 -> client1
HG2 -> No systems or different clients
Both HGs have host_registration_insights_inventory set to false initially
Later HG1 hashost_registration_insights_inventory to true and we would think that it would not cause the issue. But as long as HG2 has host_registration_insights_inventory set to false, We will continue to see this issue.
Additional Testing
If IOP do not search on inventory client param. Look at
- clones
-
SAT-41513 SingleHostReportJob fails with undefined method `subtree_ids' for nil:NilClass when host belongs to a hostgroup and value of host_registration_insights_inventory is false
-
- Release Pending
-
- links to