Bug 2249970

Summary: The notifications page in Satellite WebUI fails to load with http 500 error
Product: Red Hat Satellite Reporter: Jayant Bhatia <jbhatia>
Component: NotificationsAssignee: Eric Helms <ehelms>
Status: CLOSED ERRATA QA Contact: Pavel Novotny <pnovotny>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.14.0CC: aruzicka, bbuckingham, lstejska, pnovotny, rlavi, smeyer
Target Milestone: 6.15.0Keywords: EasyFix, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-23 17:15:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jayant Bhatia 2023-11-16 06:50:43 UTC
Description of problem:

The notifications page in Satellite WebUI fails to load with http 500 error. Below error message is observed in /var/log/foreman/production.log:
 Started GET "/notification_recipients" for 10.x.x.x at 2023-01-01 00:00:00 +0100
 [I|app|fee71ac7] Processing by NotificationRecipientsController#index as JSON
 [W|app|fee71ac7] Action failed
 [I|app|fee71ac7] Backtrace for 'Action failed' error (TypeError): incompatible marshal file format (can't be read)
 fee71ac7 |     format version 4.8 required; 123.34 given
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:8:in `load'
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:8:in `load'
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:598:in `deserialize_entry'
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache/redis_cache_store.rb:459:in `deserialize_entry'
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache/redis_cache_store.rb:349:in `block in read_entry'
 fee71ac7 | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache/redis_cache_store.rb:478:in `failsafe'


Version-Release number of selected component (if applicable): Satellite version 6.14


Foreman writes notification data to the (redis) cache as raw JSON, but then attempts to read them back using the cache default format (Ruby marshaling). This results in the UI failing to display some notifications, and persistent errors in the log that look like the example shown below. It appears it can be resolved with a one-line fix in the cache_handler to change it to pass the same "raw" parameter for reads as is used for writes:

--- cache_handler.rb 
+++ /usr/share/foreman/app/services/ui_notifications/cache_handler.rb 
@@ -7,7 +7,7 @@

     # JSON Payload
     def payload
-      result = cache.read(cache_key)
+      result = cache.read(cache_key, raw: true)
       if result
         logger.debug("Cache Hit: notification, reading cache for #{cache_key}")
         return result

This has been fixed in upstream: https://projects.theforeman.org/issues/36329

Comment 1 Bryan Kearney 2023-11-16 16:03:03 UTC
Upstream bug assigned to ehelms

Comment 2 Bryan Kearney 2023-11-16 16:03:05 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36329 has been resolved.

Comment 3 Adam Ruzicka 2024-01-16 10:35:19 UTC
*** Bug 2254009 has been marked as a duplicate of this bug. ***

Comment 4 Pavel Novotny 2024-02-07 19:05:57 UTC
Verified in Satellite 6.15 snap 9:
satellite-6.15.0-2.el8sat.noarch
foreman-3.9.1.6-1.el8sat.noarch

Calls from webUI to /notification_recipients are now successful, no errors in Foreman log either:

2024-02-07T14:00:58 [I|app|ec149afe] Started GET "/notification_recipients" for 10.x.x.x at 2024-02-07 14:00:58 -0500
2024-02-07T14:00:58 [I|app|ec149afe] Processing by NotificationRecipientsController#index as JSON
2024-02-07T14:00:58 [I|app|ec149afe] Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 0.6ms | Allocations: 1877)

Comment 7 errata-xmlrpc 2024-04-23 17:15:45 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 (Important: Satellite 6.15.0 release), 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/RHSA-2024:2010