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

Internal Server Error during insights-client upload

XMLWordPrintable

    • None
    • None
    • None
    • None

      Description of problem:

       

      Internal Server Errors logged by foreman-rh_cloud during an insights-client upload.

       

      How reproducible:

       

      100%

       

      Is this issue a regression from an earlier version:

       

      No

       

      Steps to Reproduce:

       

      1.) Register a host w/ insights to Satellite.

      2.) See errors in production.log on the Satellite.

       

      Actual behavior:

      • Internal Server Error when the response from insights is RestClient::NotModified, because we try to read the code attribute, which doesn't exist:
      2025-04-30T09:02:29 [I|app|48e5290b] Started GET "/redhat_access/r/insights/v1/static/release/insights-core.el9.egg" for 10.0.168.182 at 2025-04-30 09:02:29 -0400
      2025-04-30T09:02:29 [I|app|48e5290b] Processing by InsightsCloud::Api::MachineTelemetriesController#forward_request as */*
      2025-04-30T09:02:29 [I|app|48e5290b]   Parameters: {"path"=>"v1/static/release/insights-core.el9"}
      2025-04-30T09:02:29 [W|app|48e5290b] Action failed
      2025-04-30T09:02:29 [I|app|48e5290b] Backtrace for 'Action failed' error (NoMethodError): undefined method `code' for #<RestClient::NotModified: 304 Not Modified>
       48e5290b | /usr/share/gems/gems/foreman_rh_cloud-12.0.0/app/controllers/insights_cloud/api/machine_telemetries_controller.rb:31:in `forward_request'
      [...]
      2025-04-30T09:02:29 [I|app|48e5290b] Completed 500 Internal Server Error in 52ms (Views: 5.8ms | ActiveRecord: 4.0ms | Allocations: 15116)
      • If there is a connectivity issue to insights / iop-advisor-engine, an uninitialized constant error can also be seen:
      2025-04-29T10:44:07 [W|app|e85aa38d] Action failed
      2025-04-29T10:44:07 [I|app|e85aa38d] Backtrace for 'Action failed' error (NameError): uninitialized constant RestClient::Timeout
       e85aa38d | /usr/share/gems/gems/foreman_rh_cloud-11.4.0/app/controllers/insights_cloud/api/machine_telemetries_controller.rb:24:in `rescue in forward_request'
       e85aa38d | /usr/share/gems/gems/foreman_rh_cloud-11.4.0/app/controllers/insights_cloud/api/machine_telemetries_controller.rb:19:in `forward_request' 

      Expected behavior:

      No internal server errors.

      • Remove reference to undefined RestClient::Timeout

      https://github.com/theforeman/foreman_rh_cloud/blob/38417ad382c5553f280254683384568801648f2e/app/controllers/insights_cloud/api/machine_telemetries_controller.rb#L24

       

      From https://github.com/rest-client/rest-client/commit/b732acec1e693b728483e0d23f05b409aa383566 it looks like the timeouts are:

      RestClient::Exceptions::ReadTimeout
      RestClient::Exceptions::OpenTimeout
      RestClient::Exceptions::RequestTimeout 

      and they are returned as the response, not raised as exceptions, so they should all be handled like OpenTimeout is already:

      https://github.com/theforeman/foreman_rh_cloud/blob/38417ad382c5553f280254683384568801648f2e/app/controllers/insights_cloud/api/machine_telemetries_controller.rb#L29

       

      • Don't call @cloud_response.code on responses that don't have that attribute, like RestClient::NotModified and RestClient::Exceptions::*Timeout

       

      More details: https://github.com/rest-client/rest-client/?tab=readme-ov-file#exceptions-see-httpwwww3orgprotocolsrfc2616rfc2616-sec10html

      Business Impact / Additional info:

       

              rhn-engineering-paji Partha Aji
              rhn-support-tpapaioa Tasos Papaioannou
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: