Visit my.sonatype.com for documentation on Nexus Repository version 2.
Summary
You are noticing messages like this in your Nexus Repository log:
2014-08-05 07:19:42 INFO [qtp2021455193-55711] anonymous org.sonatype.nexus.apachehttpclient.Hc4ProviderBase$DefaultHttpClientImpl - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
2014-08-05 07:19:42 INFO [qtp2021455193-55711] anonymous org.sonatype.nexus.apachehttpclient.Hc4ProviderBase$DefaultHttpClientImpl - Retrying request
Explanation
The root cause of these messages are as discussed in NEXUS-5368.
Idle socket connections established with remotes are expiring on the remote server, but they are still 'open' as far as Nexus Repository is concerned.
Upon pulling a cached idle connection from the connection pool, a socket check is performed by the Nexus Repository HTTP Client. If the socket is now closed, you will see a message that the socket is immediately closed and the connection is retried. For example:
2014-08-06 09:32:29 DEBUG [qtp2021455193-70353] anonymous org.apache.http.impl.conn.DefaultClientConnection - Connection 0.0.0.0:53668<->216.34.181.96:80 closed
2014-08-06 09:32:29 INFO [qtp2021455193-70353] anonymous org.sonatype.nexus.apachehttpclient.Hc4ProviderBase$DefaultHttpClientImpl - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
2014-08-06 09:32:29 INFO [qtp2021455193-70353] anonymous org.sonatype.nexus.apachehttpclient.Hc4ProviderBase$DefaultHttpClientImpl - Retrying request
2014-08-06 09:32:29 DEBUG [qtp2021455193-70353] anonymous org.apache.http.impl.conn.DefaultClientConnectionOperator - Connecting to logicaldoc.sourceforge.net:80
Upon the first retry by the same thread of this initial failure ( by default there are 3 retries ), a new socket connection is opened, and the request usually succeeds.
A good command to grep for these from the Nexus Repository log file is the following:
pcregrep -A 1 -B 2 -M 'Retrying request' nexus.log
Basically, this behavior is normal and there is nothing that can be done in Nexus Repository 100% reliably here.
Ideally, the remote hosts should reply with a Keep-Alive header that states how long the connection will be kept open on the remote. For example:
Keep-Alive: timeout=10, max=127
The above header would tell Nexus Repository to treat the idle connection as expired on the remote automatically after 10 seconds.
By default, Nexus Repository will keep idle connections around for up to 30 seconds before evicting them from the pool. This is controlled by this property:
Every 5 seconds, Nexus Repository checks the pool for idle connections which have exceeded their idle time out. Theseidle connections are evicted from the pool automatically.