Bug 1919387

Summary: Console login fails with no error when it can't write to localStorage
Product: OpenShift Container Platform Reporter: Samuel Padgett <spadgett>
Component: Management ConsoleAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: aos-bugs, jokerman, yapei
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
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 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 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