bazelbuild / bazel-buildfarm

Bazel remote caching and execution service
https://bazel.build
Apache License 2.0
635 stars 199 forks source link

Fetch service does not properly handle missing content-length #1779

Closed jasonschroeder-sfdc closed 2 weeks ago

jasonschroeder-sfdc commented 2 weeks ago

for an HTTP archive like this:

http_archive(
    name = "googleapis",
    urls = ["https://github.com/googleapis/googleapis/archive/ca1372c6d7bcb199638ebfdb40d2b2660bab7b88.tar.gz"],
)

Github sends a redirect to https://codeload.github.com/googleapis/googleapis/tar.gz/ca1372c6d7bcb199638ebfdb40d2b2660bab7b88 . The redirect is followed correctly, but the

    long contentLength = connection.getContentLengthLong();

in NodeInstance.java is now -1 which prevents the Output from being created and sized.

werkt commented 2 weeks ago

we use connection.setInstanceFollowRedirects(true); to successfully follow redirects. The issue at hand is that the codeload does not include content-length in its response.

I've been avoiding this particular case - it would have been nice of github to tell the client how much data to expect, but I suppose that's what we have to live with. I'll adjust the issue.