elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
567 stars 320 forks source link

Flaky tests due to connection reset when downloading dependencies #1375

Closed felixbarny closed 4 years ago

felixbarny commented 4 years ago

Test method

Happens before tests, in the build phase

Test logs

[2020-09-01T07:08:56.951Z] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce (enforce-java) on project apm-agent-parent: Execution enforce-java of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce failed: Plugin org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-settings:jar:3.0, org.apache.maven:maven-repository-metadata:jar:3.0, org.apache.maven:maven-model-builder:jar:3.0: Could not transfer artifact org.apache.maven:maven-settings:jar:3.0 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/3.0/maven-settings-3.0.jar: Connection reset -> [Help 1]

Additional context

Lately, we see a lot of test failures because of Connection reset errors.

@elastic/observablt-robots do you know if there are network issues?

Also, why does maven even need to resolve the dependencies? Shouldn't they be cached in the image via packer cache?

SylvainJuge commented 4 years ago

There is currently some work being done by the CI team on this, not sure about the current progress and priority though.

cachedout commented 4 years ago

We may be able to add this to the image cache if it's not there already. I will investigate this.

v1v commented 4 years ago

I'm working on something else that seems similar to this issue, and this is my finding:

That particular configuration was there since the very beginning:

https://github.com/elastic/apm-agent-java/pull/1376 might fix this issue, at least the one related to the cached artifacts.

UPDATE: https://github.com/elastic/apm-agent-java/pull/1376 cannot be used in this case, since the very first build will cache all the required artifacts which will be stashed for being used later on in some other stages. Therefore, we cannot use this approach

v1v commented 4 years ago

And guess what! I faced this particular issue in my above-mentioned fix:

For what I read the -Dhttps.protocols=TLSv1.2 flag seems to be the workaround:

cachedout commented 4 years ago

Even with a change to .m2 won't the fact that we do a clean install here force the download to happen regardless of what's in the cache? Should we remove the clean keyword to rely on the cache?

v1v commented 4 years ago

the clean goal should not affect with the cached dependencies, since it's in charge for the clean up of the generated files within the workspace which are normally hosted in the target folder. The only case I imagine it will be required is when the workspace location and the .m2 point to the some location

cachedout commented 4 years ago

Yup, I just tested this and was coming back here to say that it doesn't appear to change the caching mechanism so this should be fine.