Bug 2073437 - Topology performance: Firehose/useK8sWatchResources cache can return unexpected data format if isList differs on multiple calls
Summary: Topology performance: Firehose/useK8sWatchResources cache can return unexpect...
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Dev Console
Version: 4.7
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.11.0
Assignee: Christoph Jerolimov
QA Contact: spathak@redhat.com
Depends On:
Blocks: 2077641
TreeView+ depends on / blocked
Reported: 2022-04-08 13:39 UTC by Christoph Jerolimov
Modified: 2022-08-10 11:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2022-08-10 11:05:18 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github openshift console pull 11307 0 None open Bug 2073437: Improve Firehose cache, so that it does not return unexpected data also if isList differs on two concurrent... 2022-04-08 14:11:57 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:05:41 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.