Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-19993

resumable HTTP retry when remote sends partial bytes


    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 3.16.1
    • Transport
    • None
    • 4


      A customer had an HTTP proxy server configured in NXRM 3. This HTTP proxy server for some unknown reason only responded with partial bytes.

      When an outbound proxy repository request fails due to the remote sending partial content, the HTTP request fails immediately and does not retry. Ultimately a 500 response is returned to the inbound HTTP request:

      2019-05-22 18:33:19,526+0000 WARN  [qtp541991689-9718]  admin org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /repository/Epel-7/SRPMS/Packages/m/macromilter-3.4.3-1.el7.src.rpm
      org.sonatype.nexus.blobstore.api.BlobStoreException: BlobId: tmp$89f46f6f-5e89-4c4a-be00-aecb42d9a4ad, org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 1709351; received: 1578263, Cause: Premature end of Content-Length delimited message body (expected: 1709351; received: 1578263
      "GET /repository/Epel-7/SRPMS/Packages/m/macromilter-3.4.3-1.el7.src.rpm HTTP/1.0" 500 - 2461 3751 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36"

      The Connection/Socket retry attempts value in the Nexus HTTP configuration states explicitly "Total retries if the initial connection attempt suffers a timeout". In the specific failure case discussed in this issue, the connection is already established and bytes are streaming - just not all content is sent.

      However using resumable get requests with clients such as wget or curl through the HTTP proxy server, while the initial partial content could be reproduced, the complete content could be downloaded successfully with two requests using a Range header in the second request.

      wget -e use_proxy=yes -e https_proxy=http-proxy.example.com:3128 --no-check-certificate https://dl.fedoraproject.org/pub/epel/7/SRPMS/Packages/m/macromilter-3.4.3-1.el7.src.rpm 
      --2019-05-23 13:33:41--  https://dl.fedoraproject.org/pub/epel/7/SRPMS/Packages/m/macromilter-3.4.3-1.el7.src.rpm 
      Resolving http-proxy.example.com (http-proxy.example.com)... 
      Connecting to http-proxy.example.com (http-proxy.example.com)||:3128... connected. 
      Proxy request sent, awaiting response... 200 OK 
      Length: 1709351 (1.6M) [application/x-rpm] 
      Saving to: ‘macromilter-3.4.3-1.el7.src.rpm’
      92% [=====================================================================================>        ] 1,578,263    814KB/s   in 1.9s
      2019-05-23 13:33:45 (814 KB/s) - Connection closed at byte 1578263. Retrying.
      --2019-05-23 13:33:46--  (try: 2)  https://dl.fedoraproject.org/pub/epel/7/SRPMS/Packages/m/macromilter-3.4.3-1.el7.src.rpm 
      Connecting to http-proxy.example.com (http-proxy.example.com)||:3128... connected. 
      Proxy request sent, awaiting response... 206 Partial Content 
      Length: 1709351 (1.6M), 131088 (128K) remaining [application/x-rpm] 
      Saving to: ‘macromilter-3.4.3-1.el7.src.rpm’
      100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=======>] 1,709,351    848KB/s   in 0.2s
      2019-05-23 13:33:49 (848 KB/s) - ‘macromilter-3.4.3-1.el7.src.rpm’ saved [1709351/1709351]


      In cases where a format proxy repository remote sends partial content, implement a retry mechanism using resumable gets and Range headers.

      Allow this option to be enabled globally for all outbound HTTP requests and per repository. Whether this should be the default on is TBD.




            Unassigned Unassigned
            plynch Peter Lynch
            Rich Seddon Rich Seddon
            0 Vote for this issue
            1 Start watching this issue