Bug 1919387 - Console login fails with no error when it can't write to localStorage
Summary: Console login fails with no error when it can't write to localStorage
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.7.0
Assignee: Jakub Hadvig
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-22 18:06 UTC by Samuel Padgett
Modified: 2021-02-24 15:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Version: 4.7.0-0.nightly-2021-01-22-104107 Cluster ID: a81c6d80-92a0-424c-913c-ef0ccaedace3 Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0
Last Closed: 2021-02-24 15:55:29 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 7925 0 None closed Bug 1919387: Wait till the DOM is loaded when writing to the body localStorage issue 2021-02-02 01:17:31 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:55:49 UTC

Description Samuel Padgett 2021-01-22 18:06:55 UTC
Console relies on writing to localStorage on login. This can fail (usually because there is no more space), and console just white screens in this case. We should try to catch errors and show a message. (We should also see if it's possible to continue without needing localStorage.)

We've seen this happen on different occasions in Firefox on Linux. If another website stores a large amount of data in localStorage, it prevents other websites from using it. For instance, we've seen Slack store hundreds of megabytes in localStorage, exhausting the quota.

Comment 2 Jakub Hadvig 2021-01-25 11:48:19 UTC
I assume that this occurs when console is trying to write the 'bridge/api-discovery-resources' key with its resources into the localStorage.
https://github.com/openshift/console/blob/master/frontend/public/module/k8s/get-resources.ts#L30-L32

Think that a simple solution is to dont catch the resource since they are also in the store?
https://github.com/openshift/console/blob/master/frontend/public/actions/k8s.ts#L64 

Thinking about a general solution here, cause ideally we should not store anything in the localStorage, if we wanna avoid this kind of behaviour.

Comment 3 Samuel Padgett 2021-01-25 13:52:31 UTC
I don't think that's the problem because it's surrounded by a try/catch. It's likely somewhere else. I believe it's happening here:

https://github.com/openshift/console/blob/master/frontend/public/tokener.html#L8-L17

The "document.body is null" error appears to be happening when we try to add an error message to the page.

Comment 5 Yadan Pei 2021-02-03 06:34:22 UTC
visit console in Firefox, current fix is stop loading console if we meet `DOMException: The quota has been exceeded` error. We show message: localStorage must be enabled:The quota has been exceeded on the page when console loads failed 

per comment in fix PR this is working as intended, in a following up PR we may consider continue even after the error.

Verified on 4.7.0-0.nightly-2021-02-02-164630

Comment 8 errata-xmlrpc 2021-02-24 15:55:29 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement 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.

https://access.redhat.com/errata/RHSA-2020:5633


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