Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-9706

NPM Remote repository may thrown a 400 if a meta-data resource has expired and the subsequent pull from the remote site fails with a connection time out.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 4.5.1, 4.6.1
    • Fix Version/s: 4.8.0
    • Component/s: NPM
    • Labels:
      None

      Description

      NPM Remote repository may thrown a 400 if a meta-data resource has expired and the subsequent pull from the remote site fails with a connection time out. Expected behavior is to returned the cached data instead of an error in the case of a timeout.

      To reproduce:

      1. Create a remote repository that points to the official NPM repository (https://registry.npmjs.org)
      2. Set the 'Retrieval Cache Period' to 1 second
      3. Set the 'Socket Timeout' for the repository to a value where it will allow it to work sometimes and timeout sometimes (between 125-175 ms)
      4. Create a script that keeps calling GET on /artifactory/api/npm/<remote-repo-name>/ua-parser

      • Something like this:
      #!/bin/bash
      for i in {1..1000}
      do
      curl -X GET http://192.168.99.100:8081/artifactory/api/npm/npmjs/ua-parser > out.txt
      sleep .5
      done
      

      This should eventually reproduce the issue. Look for a 400 return code in the request logs or this set of errors in the Artifactory logs:

      2016-03-30 19:13:57,692 [http-nio-8081-exec-6] [ERROR] (o.a.r.RemoteRepoBase:745) - IO error while trying to download resource 'npmjs:.npm/ua-parser/package.json': org.apache.http.conn.ConnectTimeoutException: Connect to registry.npmjs.org:443 [registry.npmjs.org/23.235.44.162] failed: Read timed out
      2016-03-30 19:13:57,692 [http-nio-8081-exec-6] [ERROR] (o.a.a.n.r.NpmRemoteRepoHandler:362) - Error while parsing the response of a remote npm JSON query on 'https://registry.npmjs.org/ua-parser': Connect to registry.npmjs.org:443 [registry.npmjs.org/23.235.44.162] failed: Read timed out
      

      NOTE: This does NOT occur with every timeout issue, only sometimes. The artifactory log shows the difference between these two timeouts. Observe:

      Timeout that causes the 400

      2016-03-30 19:13:57,692 [http-nio-8081-exec-6] [ERROR] (o.a.r.RemoteRepoBase:745) - IO error while trying to download resource 'npmjs:.npm/ua-parser/package.json': org.apache.http.conn.ConnectTimeoutException: Connect to registry.npmjs.org:443 [registry.npmjs.org/23.235.44.162] failed: Read timed out
      2016-03-30 19:13:57,692 [http-nio-8081-exec-6] [ERROR] (o.a.a.n.r.NpmRemoteRepoHandler:362) - Error while parsing the response of a remote npm JSON query on 'https://registry.npmjs.org/ua-parser': Connect to registry.npmjs.org:443 [registry.npmjs.org/23.235.44.162] failed: Read timed out
      

      Timeout that does NOT cause the 400

      2016-03-30 19:13:50,848 [http-nio-8081-exec-6] [WARN ] (o.a.r.RemoteRepoBase:428) - npmjs: Error in getting information for '.npm/ua-parser/package.json' (Failed retrieving resource from https://registry.npmjs.org/ua-parser: Connect to registry.npmjs.org:443 [registry.npmjs.org/23.235.44.162] failed: connect timed out).
      

        Attachments

          Activity

            People

            • Assignee:
              shayy Shay Yaakov (Inactive)
              Reporter:
              arturoa Arturo Aparicio
            • Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: