You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicVoidhandleResponse(Responseresponse) ... {
// Notifies the progress dispatcher that the total bytes we will read is the "Content-Length" value.// If `Content-Encoding: gzip`, the value will be the size of the compressed content.blobSizeConsumer.accept(response.getContentLength());
try (OutputStreamoutputStream =
newNotifyingOutputStream(destinationOutputStream, writtenByteCountListener)) {
BlobDescriptorreceivedBlobDescriptor =
Digests.computeDigest(response.getBody(), outputStream);
...
}
Now, in the case of Content-Encoding: gzip (or something similar), Google HTTP Client's HttpResponse::getContent() creates and returns GZIPInputStream that wraps the raw InputStream, which means the library does the chore of streamed unzipping on behalf of us. Content-Length will of course be the size of the original (compressed) content stream.
Then NotifyingOutputStream::write() will periodically notify the progress dispatcher how many bytes were written (through writtenByteCountListener). The problem is that the progress dispatcher is initialized with the total allocation size (through blobSizeConsumer) to be the value reported in Content-Length. Because we will write uncompressed content to outputStream in this case, we will go over the progress limit.
Another case where the progress is under reported:
From #1512 (comment).
Now, in the case of
Content-Encoding: gzip
(or something similar), Google HTTP Client'sHttpResponse::getContent()
creates and returnsGZIPInputStream
that wraps the rawInputStream
, which means the library does the chore of streamed unzipping on behalf of us.Content-Length
will of course be the size of the original (compressed) content stream.Then
NotifyingOutputStream::write()
will periodically notify the progress dispatcher how many bytes were written (throughwrittenByteCountListener
). The problem is that the progress dispatcher is initialized with the total allocation size (throughblobSizeConsumer
) to be the value reported inContent-Length
. Because we will write uncompressed content tooutputStream
in this case, we will go over the progress limit.Another case where the progress is under reported:
jib/jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/ExtractTarStep.java
Line 155 in 85bb1c5
The
NotifyingOutputStream
will report written byte count. The count will be smaller than the original file size, as the written content is compressed.The text was updated successfully, but these errors were encountered: