Bug 1883563

Summary: Creating duplicate namespace from create namespace modal breaks the UI
Product: OpenShift Container Platform Reporter: Harish Govindarajulu <hgovinda>
Component: Management ConsoleAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.6CC: aos-bugs, jokerman, jonjacks, spadgett, yapei
Target Milestone: ---Keywords: UpcomingSprint
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Create a namespace that already exists on the cluster. Consequence: Unhandled promise rejection error. Fix: Add error handler when creating projects. Result: Creating duplicate project wont cause unhandled promise rejection error.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:21:17 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:
Attachments:
Description Flags
broken UI none

Description Harish Govindarajulu 2020-09-29 15:09:08 UTC
Created attachment 1717569 [details]
broken UI

Created attachment 1717569 [details]
broken UI

Description of problem:
Creating duplicate namespace breaks the UI. The issue only occurs in a dev environment (and not in production env). In both cases, however, the console log shows:
- a 409 conflict for HTTP POST
- Unhandled promise rejection error 

Steps: 
1. Login to the OCP console UI 
2. In Adminitrator perspective, navigate to Administration -> Namespaces page. 
3. Create a namespace that already exists in the system. 

Actual Results:
Shows the error: "namespaces <duplicate namespace> already exists" but the UI breaks with following call stack :

rejectionHandler
  vendors~main-f992bf47c06fae930750.js:230383:21


Version-Release number of selected component (if applicable):
4.6

How reproducible:
Always

Comment 1 Samuel Padgett 2020-09-29 16:37:03 UTC
This is the overlay from the Webpack dev server on an unhandled promise rejection. You'd only ever see this in development mode, but we should probably handled the failed promise. I thought we found all the dialogs in https://github.com/openshift/console/pull/6048, but we might have missed one.

Comment 2 Jon Jackson 2020-09-29 19:33:33 UTC
Yeah, I saw that this was dev mode only. I asked Harish to update the description to add that distinction. We do still get a console error about an uncaught promise rejection, so I thought this might be a good low severity bug for Harish to look into.

Comment 3 Samuel Padgett 2020-09-29 19:42:07 UTC
Yeah, I think it's something we want to address. Better to explicitly handle failed promises even if it's not a user-visible bug.

Comment 5 Yadan Pei 2020-10-26 05:48:05 UTC
Steps: 
1. Pull latest console code, follow steps in https://github.com/openshift/console#build-everything and https://github.com/openshift/console#openshift-no-authentication, bridge to a 4.7 cluster
2. visit OCP console UI at localhost:9000
3. In Adminitrator perspective, navigate to Administration -> Namespaces page. 
4. Create a namespace that already exists in the system, we can see js errors in browser console

POST http://localhost:9000/api/kubernetes/api/v1/namespaces 409 (Conflict)
coFetch @ co-fetch.js:112
(anonymous) @ co-fetch.js:151
(anonymous) @ ui.ts:413
push../public/co-fetch.js.__awaiter @ ui.ts:413
coFetchCommon @ co-fetch.js:147
coFetchJSON @ co-fetch.js:162
coFetchSendJSON @ co-fetch.js:181
push../public/co-fetch.js.coFetchJSON.post @ co-fetch.js:189
k8sCreate @ resource.js:64
createNamespace @ create-namespace-modal.jsx:54
_submit @ create-namespace-modal.jsx:79
callCallback @ react-dom.development.js:347
invokeGuardedCallbackDev @ react-dom.development.js:397
invokeGuardedCallback @ react-dom.development.js:454
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:468
executeDispatch @ react-dom.development.js:600
executeDispatchesInOrder @ react-dom.development.js:622
executeDispatchesAndRelease @ react-dom.development.js:725
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:733
forEachAccumulated @ react-dom.development.js:707
runEventsInBatch @ react-dom.development.js:750
runExtractedPluginEventsInBatch @ react-dom.development.js:881
handleTopLevel @ react-dom.development.js:5901
batchedEventUpdates @ react-dom.development.js:2344
dispatchEventForPluginEventSystem @ react-dom.development.js:5996
dispatchEvent @ react-dom.development.js:6025
unstable_runWithPriority @ scheduler.development.js:643
runWithPriority$2 @ react-dom.development.js:11305
discreteUpdates$1 @ react-dom.development.js:21672
discreteUpdates @ react-dom.development.js:2359
dispatchDiscreteEvent @ react-dom.development.js:5979
react_devtools_backend.js:2450 

Failed to create namespace: namespaces "yapei47" already exists
overrideMethod @ react_devtools_backend.js:2450
(anonymous) @ create-namespace-modal.jsx:102
Promise.catch (async)
_submit @ create-namespace-modal.jsx:98
callCallback @ react-dom.development.js:347
invokeGuardedCallbackDev @ react-dom.development.js:397
invokeGuardedCallback @ react-dom.development.js:454
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:468
executeDispatch @ react-dom.development.js:600
executeDispatchesInOrder @ react-dom.development.js:622
executeDispatchesAndRelease @ react-dom.development.js:725
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:733
forEachAccumulated @ react-dom.development.js:707
runEventsInBatch @ react-dom.development.js:750
runExtractedPluginEventsInBatch @ react-dom.development.js:881
handleTopLevel @ react-dom.development.js:5901
batchedEventUpdates @ react-dom.development.js:2344
dispatchEventForPluginEventSystem @ react-dom.development.js:5996
dispatchEvent @ react-dom.development.js:6025
unstable_runWithPriority @ scheduler.development.js:643
runWithPriority$2 @ react-dom.development.js:11305
discreteUpdates$1 @ react-dom.development.js:21672
discreteUpdates @ react-dom.development.js:2359
dispatchDiscreteEvent @ react-dom.development.js:5979

But console does not crash, moving to VERIFIED

Comment 9 errata-xmlrpc 2021-02-24 15:21:17 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