Nexus 3 - Read Timeout for Central (Premature end of content)

I am running Nexus 3.16.1-02 OSS on Ubuntu 16.04.6 and I am having an issue retrieving files from Maven Central. The system has been in place for some time and was working previously, although I don’t know when it started to have issues.

The issue is not 100% straight forward from what I can tell. I am able to download some files but not others and I haven’t been able to determine yet if it is a size issue or related to the type. I haven’t found an issue with the POM files, the JavaDoc JARs, or the Source JARs; but JAR types are failing at least in my test cases. I validated some other repositories and I am able to retrieve JAR files that are larger than my test cases.

Here is the error message I see in the logs for the failures (sizes of course vary):

2019-05-31 20:53:54,385-0400 WARN [qtp1713836254-217] admin com.google.common.io.Closeables - IOException thrown while closing Closeable.
org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 581529; received: 580861
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:198)
at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:101)
at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:143)
at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)

One of my first thoughts was that I am behind a firewall but the following command does work when running on the server:

wget https://repo1.maven.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jar

where the following causes the error to occur after a timeout period (note that the describe indicates there is a read timeout as does the Maven command):

http://my-nexus-server/nexus/repository/public/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jar?describe

and as I said before the following does work:

http://my-nexus-server/nexus/repository/public/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189-javadoc.jar?describe

Any help would be greatly appreciated!

One quick update. I tried to retrieve bsf.bsf:2.2:jar which is actually smaller then the JavaDoc for the sonar-scanner-api and that did work. This leads me to believe it is may be an issue with size. With that said I still don’t understand why I can both sync larger files from a different repository and download the same JAR file that fails with wget.

Again any help would be appreciate!

The problem here is not in Nexus… it is waiting for the bytes, and the connection is not receiving all of them.

2019-05-31 20:53:54,385-0400 WARN [qtp1713836254-217] admin com.google.common.io.Closeables - IOException thrown while closing Closeable.
org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 581529; received: 580861

I’d investigate the network path that this request is going through. Is there an http proxy server configured in Nexus? If so, check its error logs.

It would also be worth trying curl -v, to see if an unexpected response is occurring.

curl -v https://repo1.maven.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jar > /dev/null

I saw a case recently where a firewall was returning HTTP 206 (partial content) even though Nexus Repo does not send an “If-Range” header. That isn’t valid: HTTP/1.1: Status Code Definitions

Rich

I’m getting a 206 with some difference in the payload response attribute that that of the other successfully downloaded artifacts, example below

Successfully downloaded file response:

Response{status=Status{successful=true, code=200, message='null'}, payload=Content{payload=BlobPayload{blob=org.sonatype.nexus.blobstore.file.FileBlobStore$2b6abf03, contentType='application/java-archive'}, attribute.......}

Failed file to be downloaded response:

Response{status=Status{successful=true, code=206, message='null'}, payload=org.sonatype.nexus.repository.http.partialPayload@14eccbf9}

I can as well download the file using curl, yet not from the UI