-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Premature end of chunk coded message body after upgrading to 3.1.3 #3409
Comments
Maybe this is because we upgraded Google HTTP Client library. #3387 😫 |
@rmaclean-ee @abithgs @creekpld I can't reproduce it. Can anyone give us detailed HTTP logs by following these instructions also with And is this consistently reproducible, remotely and locally? |
|
You said this is on a GitLab pipeline, so I was referring to that as remote. "Locally" means running Jib on your machine to connect to GCR. |
@chanseokoh I can provide you with the logs, but these are huge and contain tons of sensitive information. Even if I try to censor the most sensitive data, I am afraid it may still contain too much to share publicly. |
@ChristianCiach it should be enough to give us the portion around the failure point. (If needed, I can ask more.) Then it'd be easy to scrub sensitive information? Oh, but the stacktrace you get with |
jib.log I did my best :) We are using a local docker-hub mirror. The hostname of the mirror has been scrubbed to Jib has been configured to use this mirror by using the file
The issue only happens with the current Jib versions, locally (on the workstations) and on privately hosted Jenkins/GitLab. Edit: We use a Harbor registry as a docker-hub mirror. Maybe the issue lies in Harbor, but earlier versions of Google HTTPClient were more tolerant? Edit: On closer inspection, the error seems to happen when connecting to the target registry, which is the registry Jib is supposed to push the built image to. This registry is called |
@ChristianCiach did you supply |
@chanseokoh Executed command was:
With the The log looks reasonable to me. I can reproduce it anytime if you need me to change anything. |
I just notice that my issue doesn't seem to be exactly the same as described in this github issue. Nowhere in my logs does it say But I guess it's probably caused by the same underlying issue. |
Okay, it helped to confirm the command. I can explain why it failed. It's just that I'm trying to track down why this started to happen in the newer HTTP library version. Jib contacts
What's unusual is that, it says that the length of the body the server will return is 2 ( So basically it's the fault of the server, whether it's the reverse proxy or the target registry behind it. |
That's right, the issue only happens with 3.1.3. Everything works fine with 3.1.2. I pretty much have come to the same conclusions as you have. Which got me thinking: Does the target-registry-server also reports ... After I've written the previous paragraghs, I've tried the curl commands directly on the shell. Turns out, the server is right to report a See:
|
So do you see |
I do not:
|
Thanks a lot for debugging. I don't see any change in the newer Apache HTTP libraries, so I wonder if this is due to some changes in Google HTTP libraries. Using the method here, you'll be able to force the HTTP libraries versions in 3.1.2 (described as 2.8.0 dependencies in the link). Can you force the old versions and see if it works? |
In any case, not seeing |
Using Jib 3.1.3 and the "2.8.0" dependencies does work without issues.
I don't think this is the case. As I said: When I execute the exact same curl command that Jib logs as the Edit: The |
Ah, sorry. I mistakenly thought the curl was against the target registry and not through the proxy. What you said makes sense. Something definitely happened in the upgraded HTTP libraries. I also wonder why |
Works with
Does not work with
That should narrow it down... |
I kinda suspect this one to be the culprit: googleapis/google-http-java-client@f84ed59 I have no hard proof for that, but the exception does happen when closing the stream:
Sorry for the comment spam. By the way, I really appreciate your help @chanseokoh |
That looks like it! It's from I think at this point perhaps we should just revert the HTTP libraries to old versions. Maybe the versions used in Jib 2.7.0 to also resolve the perplexing #3058. Really appreciate your help with debugging this. |
Just to make absolutely sure, I've just compiled my own version of google-http-client 1.39.2 with googleapis/google-http-java-client@f84ed59 reverted. I can confirm that this commit is the cause of the issue. |
I also have this issue with the Jib Maven plugin after upgrading from 3.1.2 to 3.1.3, but it seems like you have already found what the issue is. |
@ChristianCiach what's the target registry? And just asking, is there an easy way for me to set it up? |
@chanseokoh These are some tough questions, because I am not the one who set up the registry. Fortunately I do have SSH access to the server, so let's see what I can found out. Surprisingly (and sorry for unintentionally lying about this yesterday) the registry itself and nginx are not deployed as containers, but as native packages:
There are actually two reverse proxies (apache and nginx), because apparently you can never have enough of those. The setup is httpd.conf:
nginx.conf:
/etc/docker-distribution/registry/config.yml:
That being said, I can't see anything too exotic or surprising here. When viewed from the outside (using curl) everything looks as expected. |
Maybe this is the crucial part to be able to reproduce it?:
|
@ChristianCiach It seems infeasible for me to reconstruct your environment :( Instead, can you try these on your machine?
All it does is to make a GET request using Google HTTP 1.39.2 like how Jib does. HttpResponse res = reqFactory.buildGetRequest(new GenericUrl(args[0])).execute();
res.disconnect(); // Will this fail as in Jib 3.1.3?
System.out.println("Didn't fail :("); |
There you go:
I do have an idea how you should be able to recreate the issue, just by using a simple docker-compose setup with two containers. Give me a few minutes to try that... |
Thanks for trying! Much appreciated. I was also trying to reproduce this with a simple HTTP server locally, but the problem so far is that At least it's good to confirm this is reproducible with simple |
By the way, the new retry mechanism is annoying. I am using
Sorry for being off-topic, but this is the reason why it takes some time to create a reproducable example for you.
I am still sceptical about that. Even with verbose output of curl I don't see anything that seems wrong with the server response. |
Ah, I failed to anticipate the problem of retrying when About retrying, maybe you can use Jib 3.1.2 while forcing Google HTTP 1.39.2? |
Incredible... I can reproduce the issue, but only with ancient Apache httpd versions (up to It has nothing to do with the nginx or the registry. Even when just serving files, Google-HttpClient requesting https://localhost:8443 running an ancient Apache httpd will trigger the issue:
Of course, I had to hack your client from https://github.com/chanseokoh/docker-hub-upload-speed-test to ignore the invalid ssl cert: private static HttpRequestFactory reqFactory;
static {
try {
reqFactory = new ApacheHttpTransport.Builder().doNotValidateCertificate().build().createRequestFactory();
} catch(Exception e) {
throw new RuntimeException(e);
}
} I don't know how to interpret this. The issue only appears with ancient HTTP servers with SSL enabled, but this doesn't necessarily mean that the server is at fault. You should be able to easily reproduce this example following these steps:
|
I want to mention again that I've never seen the error message |
One more comment: The issue can also be seen by just connecting your client from https://github.com/chanseokoh/docker-hub-upload-speed-test (branch jib-i3409-debug) to https://eu.gcr.io/ (as shown in the original issue description):
Have a nice weekend!! Edit: Funny, the stacktrace is different. |
@ChristianCiach that is an incredible detective work!
I was really surprised to hear this, because I did try |
Downgraded the Google HTTP libraries versions to 1.34.0 in #3415 to avoid this issue. Closing. |
@rmaclean-ee @ChristianCiach @steven-sheehy @danilofnmoreira @abithgs @creekpld @yuri-sergiichuk @nhmarujo We just released Jib plugins 3.1.4 which downgraded Google HTTP libraries to 1.34.0. I expect the new release will avoid the issue, unless Gradle overrides the versions. If Gradle overrides them (which often happens unfortunately), one option is to force versions. |
I experienced a similar issue to this with Gradle -- even after downgrading jib to an earlier version, the output from --debug mode still showed Jib using the newer, 1.39+ version of Google HTTP Client libraries. One of our other dependencies in our Java app had upgraded to the newer Google HTTP library, and this was overwriting what Jib/Gradle were using. Adjusting our dependency there resolved the issue. |
@isptech yeah, in Gradle we often see dependencies are easily overridden with newer versions. You said you resolved the issue, but I just wanted to let you know that you can always force certain versions as a last resort. |
Environment:
Description of the issue:
Upgraded from 3.1.2 to 3.1.3 and now getting an error when pulling an image from GCR
This causes it to completely fail
Expected behavior:
It would still work the same from 3.1.2
Steps to reproduce:
jib-gradle-plugin
Configuration:Log output:
The text was updated successfully, but these errors were encountered: