[ 
https://issues.apache.org/jira/browse/MNG-6199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15949679#comment-15949679
 ] 

Michael Osipov commented on MNG-6199:
-------------------------------------

I am very much convinced that this is a problem with your NAT and/or Atlassian 
Pipelines and I will tell you why:

Nature of HTTP/1.1 connections in connection with Apache HttpClient: all HTTP 
connections are persistent and can be left open for an indefinite amount of 
time unless either client or server say {{Connection: close}}. HttpClient will 
pool connections until the aforementioned event will happen. If one side closes 
the connection, it remains stale and the peer has no way to detect that 
reliably. 
[Here|https://blog.fastmail.com/2011/06/28/http-keep-alive-connection-timeouts/]
 and 
[there|https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html]
 are good reads on your issue. Closing connections is none of your NAT's 
business.

How to tackle this issue: first of all, download Maven 3.5.0-beta-1, it 
includes an all new Maven Wagon version which can have logging be enabled on 
the *shaded* HttpClient. Read 
[this|https://hc.apache.org/httpcomponents-client-ga/logging.html] and enable 
"best for debugging". You'll see all request/response headers and even more 
important the pool management and how long are connections kept in the pool. 
Share them here.

Counter measures: HttpClient offers a lot of config params how connections are 
treated which are not exposed via Wagon because no one ever needed them. What 
you can try immediately is to pass 
{{-Dmaven.wagon.http.pool=false}}/{{-Dhttp.keepAlive=false}} or set request 
header {{Connection: close}} (performance degregation) in your {{settings.xml}}.

{{PoolingHttpClientConnectionManager}} offers a lot of other possibilities to 
solve your issue. Let's see how we get with the stuff above first.

> Maven does not attempt to reconnect reset connections
> -----------------------------------------------------
>
>                 Key: MNG-6199
>                 URL: https://issues.apache.org/jira/browse/MNG-6199
>             Project: Maven
>          Issue Type: Bug
>            Reporter: Martin MyslĂ­k
>
> I was recently discussing and issue with Atlassian team concerning failing 
> build on Atlassian Pipelines when running Maven build for more than 5 minutes.
> The issue was with NAT timeout which kills all idle connections after 5 
> mintues and Maven does not try to reconnect once the connection is killed 
> (and hence cannot download artifacts from Maven central).
> Please, take a look at the open issue (it contains more detailed description 
> and also comments from Atlassian which suggested opening an issue with 
> Maven): 
> https://bitbucket.org/site/master/issues/13988/pipelines-kills-idle-maven-connections
> Could you, please, take a minute and explain how could proceed with solving 
> this issue? I am not sure whether this is something that Maven should handle 
> or whether it is Atlassians issue.
> Thank you for your input. 
> This is the link to my public repo with test project running tests for 15 
> mintues. This build fails on Pipelines because of Maven connection that is 
> being killed during the test: https://bitbucket.org/Smedzlatko/del-me



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to