Bug 2073437

Summary: Topology performance: Firehose/useK8sWatchResources cache can return unexpected data format if isList differs on multiple calls
Product: OpenShift Container Platform Reporter: Christoph Jerolimov <cjerolim>
Component: Dev ConsoleAssignee: Christoph Jerolimov <cjerolim>
Status: CLOSED ERRATA QA Contact: spathak <spathak>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: aos-bugs, nmukherj
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 11:05:18 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:
Bug Depends On:    
Bug Blocks: 2077641    

Description Christoph Jerolimov 2022-04-08 13:39:16 UTC
Description of problem:
This is a follow-up ticket on https://bugzilla.redhat.com/show_bug.cgi?id=2053685 (Topology performance: Immutable .toJSON consumes a lot of CPU time when rendering a large topology graph) where we added a cache for the Immutable.js data when cloning them deeply for a Firehose or useK8sWatchResources consumer.

But in 4.9 the developer console crashes when importing an application because there were two components requesting secrets:

1. In SourceSecretSelector a useK8sWatchResource hook requests ONE secret.

   { kind: Secret, namespace, name: secretName, optional: true, isList: false }

2. A child of SourceSecretSelector, SourceSecretDropdown, also requests all Secrets to allow the user to select this secret.

   { kind: Secret, namespace, isList true }

Unluckily secret name was undefined (an empty string) when importing a new deployment the internal ReduxID was the same. This happen because the name wasn't part of the query parameter, see makeReduxID and makeQuery, which is used as reduxID.

Because the hook was called with `isList: false` it returns and caches the pure API response. (Which contains all Secrets btw, but as a SecretList API response instead of an array.)

The Firehose component then reuses the cached result but expected that it is an array and failed. Because this crash happens only on 4.9 Jai fixed this with a small change here https://github.com/openshift/console/pull/11256.

Instead of returning equal, but not the same data for these cases, we should improve the cache in a more generic way - and fix that SourceSecretSelector calls useK8sWatchResource without a name.

Version-Release number of selected component (if applicable):
The cache is backported already to 4.8 and will be backported also to 4.7. An improvement of the cache should be also backported back to 4.7.

The crash in 4.9 is already fixed. So that we don't know at the moment if there is another issue or not.

(Un)luckily not anymore since the fix/workaround https://github.com/openshift/console/pull/11256 was already merged.

Comment 3 Christoph Jerolimov 2022-04-25 09:17:31 UTC
As described this issue could not be reproduced. But the console works fine, incl. helm pages and import from git.

Verified on 4.11.0-0.nightly-2022-04-24-135651

Comment 5 errata-xmlrpc 2022-08-10 11:05:18 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: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.