Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`grafana-cli plugins install` fails with "Corrupt http response from source. Please try again." when encountering HTTP Chunked Encoding #13079

Closed
mulmschneider opened this Issue Aug 29, 2018 · 4 comments

Comments

Projects
None yet
6 participants
@mulmschneider
Copy link

mulmschneider commented Aug 29, 2018

When trying to install the snuids-trafficlights-panel via the grafana-cli I ran into random installation failures.
As it turns out, these happen every time the codeload.github.com CDN does not provided a HTTP content length but instead uses chunked encoding.

I don't know much Go, but I suspect that this is caused by passing resp.ContentLength directly to the zip reader here, which is probably -1 for this case.

My Grafana version: version=5.2.2 commit=aeaf7b2 compiled=2018-07-25T11:17:28+0000

curl https://grafana.com/api/plugins/snuids-trafficlights-panel/versions/1.4.2/download
{
  "url": "https://codeload.github.com/snuids/trafficlights-panel/legacy.zip/6819bc321784a842f85990f533181cb36bf51449",
  "downloads": 11900
}
$ curl -v https://codeload.github.com/snuids/trafficlights-panel/legacy.zip/6819bc321784a842f85990f533181cb36bf51449 > /tmp/blub
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 192.30.253.120...
* TCP_NODELAY set
* Connected to codeload.github.com (192.30.253.120) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [217 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [112 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2850 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Jun 19 00:00:00 2018 GMT
*  expire date: Jul 10 12:00:00 2019 GMT
*  subjectAltName: host "codeload.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
} [5 bytes data]
> GET /snuids/trafficlights-panel/legacy.zip/6819bc321784a842f85990f533181cb36bf51449 HTTP/1.1
> Host: codeload.github.com
> User-Agent: curl/7.58.0
> Accept: */*
> 
{ [5 bytes data]
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Access-Control-Allow-Origin: https://render.githubusercontent.com
< Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
< Strict-Transport-Security: max-age=31536000
< Vary: Authorization,Accept-Encoding
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-XSS-Protection: 1; mode=block
< ETag: "6819bc321784a842f85990f533181cb36bf51449"
< Content-Type: application/zip
< Content-Disposition: attachment; filename=snuids-trafficlights-panel-6819bc3.zip
< X-Geo-Block-List: 
< Date: Wed, 29 Aug 2018 14:56:37 GMT
< X-GitHub-Request-Id: 88B4:5750:A9401:14ECF0:5B86B425
< 
{ [5 bytes data]
100  728k    0  728k    0     0   591k      0 --:--:--  0:00:01 --:--:--  591k
* Connection #0 to host codeload.github.com left intact
$ grafana-cli plugins install snuids-trafficlights-panel
installing snuids-trafficlights-panel @ 1.4.2
from url: https://grafana.com/api/plugins/snuids-trafficlights-panel/versions/1.4.2/download
into: /var/lib/grafana_plugins

Failed downloading. Will retry once.
Failed downloading. Will retry once.

Error: ✗ Corrupt http response from source. Please try again.


NAME:
   Grafana cli plugins install - install <plugin id> <plugin version (optional)>

USAGE:
   Grafana cli plugins install [arguments...]
@CyrilPeponnet

This comment has been minimized.

Copy link

CyrilPeponnet commented Aug 30, 2018

Same here... quite random but pretty annoying.

@marefr marefr added the type/bug label Aug 30, 2018

@marefr marefr added this to the 5.4 milestone Aug 30, 2018

@bergquist bergquist self-assigned this Sep 3, 2018

bergquist added a commit to bergquist/grafana that referenced this issue Sep 3, 2018

cli: avoid rely on response.ContentLength
response.ContentLength might be invalid if the http response
is chunked.

fixes grafana#13079

torkelo added a commit that referenced this issue Sep 3, 2018

cli: avoid rely on response.ContentLength (#13120)
response.ContentLength might be invalid if the http response
is chunked.

fixes #13079

@torkelo torkelo modified the milestones: 5.4, 5.3 Sep 3, 2018

@marefr marefr modified the milestones: 5.3, 5.3.0-beta1 Sep 6, 2018

marefr added a commit that referenced this issue Sep 7, 2018

cli: avoid rely on response.ContentLength (#13120)
response.ContentLength might be invalid if the http response
is chunked.

fixes #13079
(cherry picked from commit ee1083d)

matrixik added a commit to matrixik/grafana that referenced this issue Sep 12, 2018

cli: avoid rely on response.ContentLength (grafana#13120)
response.ContentLength might be invalid if the http response
is chunked.

fixes grafana#13079
(cherry picked from commit ee1083d)

(cherry picked from commit c53d7ad)
@greg-pendlebury

This comment has been minimized.

Copy link

greg-pendlebury commented Jan 16, 2019

Following searches for the 'Corrupt http response from source' landed me here as well, but in my case it came from running the Grafana installation out of the Azure Marketplace, which looks to still be wrapping up v5.1.3 and then failing to install. It doesn't leave things in a particularly recoverable state either. Any hints on whether this issue is reflected elsewhere?

2019-01-16 21:31:29: Downloading grafana with version 5.1.3
...
2019-01-16 21:31:51: Install grafana-azure-monitor-datasource
installing grafana-azure-monitor-datasource @ 0.3.0
from url: https://grafana.com/api/plugins/grafana-azure-monitor-datasource/versions/0.3.0/download
into: /var/lib/grafana/plugins

Failed downloading. Will retry once.
Failed downloading. Will retry once.

Error: ✗ Corrupt http response from source. Please try again.


NAME:
 Grafana cli plugins install - install <plugin id> <plugin version (optional)>

USAGE:
 Grafana cli plugins install [arguments...]
@marefr

This comment has been minimized.

Copy link
Member

marefr commented Jan 17, 2019

@greg-pendlebury we've had some issues with publishing updated version to Azure Marketplace. We've tried to reach out to Microsoft for help but that have been kind of a dead end.

Recommendation to run a newer version of Grafana would be to spin up a VM and manually install Grafana.

@greg-pendlebury

This comment has been minimized.

Copy link

greg-pendlebury commented Jan 20, 2019

Thanks @marefr, I have started that path in between other tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.