Bug 1873612 - Monitoring: Alerts "after all" hook for "creates and expires a Silence"
Summary: Monitoring: Alerts "after all" hook for "creates and expires a Silence"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.6
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.6.0
Assignee: David Taylor
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-28 18:25 UTC by David Taylor
Modified: 2020-10-27 16:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 16:35:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
"Unexpected end of JSON input" (536.34 KB, image/png)
2020-08-28 18:26 UTC, David Taylor
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 6490 0 None closed Bug 1873612: Handle empty responses if Content-Length is not specified 2020-09-07 01:06:58 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:35:55 UTC

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


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