Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1873612

Summary: Monitoring: Alerts "after all" hook for "creates and expires a Silence"
Product: OpenShift Container Platform Reporter: David Taylor <dtaylor>
Component: Management ConsoleAssignee: David Taylor <dtaylor>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: aos-bugs, jokerman, yapei
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:35:38 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
"Unexpected end of JSON input" none

Description David Taylor 2020-08-28 18:25:13 UTC
Attempting to Expire a Silence results in "Unexpected end of JSON input" after clicking on the [Expire Silence] button in the Expire Silence modal.

Comment 1 David Taylor 2020-08-28 18:26:30 UTC
Created attachment 1713003 [details]
"Unexpected end of JSON input"

Comment 4 David Taylor 2020-09-01 19:38:56 UTC
Traced down this flake.

When 'Expiring A Silence' in normal console, `response.headers.get('Content-Length')' = '0' is true and co-fetch code returns "promise that resolves with an empty object"

https://github.com/openshift/console/blob/cf7744e55f10bd7f05eafd57d8485254862faba8/frontend/public/co-fetch.js#L157 


When 'Expiring A Silence' from Cypress, `response.headers.get('Content-Length')` = null! So co-fetch code continues on and eventually tries to return `response.json()`, which fails due to no json ("Unexpected end of JSON input"):

https://github.com/openshift/console/blob/cf7744e55f10bd7f05eafd57d8485254862faba8/frontend/public/co-fetch.js#L163


Wonder if this:

    // If the response has no body, return promise that resolves with an empty object
    if (response.headers.get('Content-Length') === '0') {
      return Promise...

Should be changed to this:

    // If the response has no body, return promise that resolves with an empty object
    if (response.headers.get('Content-Length') === '0' ----> || response.headers.get('Content-Length') === null  <-----) {
      return Promise

Would like to understand why Cypress is returning null for `response.headers.get('Content-Length')` though.

Comment 8 David Taylor 2020-09-08 13:32:31 UTC
Hi XiaochuanWang, the ''Content-Length'=null` was an error in the console code which was fixed via the associated github PR, so the issue has been fixed.  If you can expire a silence, then all is good.

Comment 9 XiaochuanWang 2020-09-09 01:57:55 UTC
Hi David, I checked the different ways of expire a silence, no empty length response header from the requests. Then the bug could be Verified. 
Thanks for your info.
Verified on 4.6.0-0.nightly-2020-09-07-191134

Comment 12 errata-xmlrpc 2020-10-27 16:35:38 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 (OpenShift Container Platform 4.6 GA Images), 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/RHBA-2020:4196