Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1299

FileNotFoundException on Cached Variant

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.3, 4.2.4, 4.3 Beta1
    • Fix Version/s: 4.2.5
    • Component/s: HttpCache
    • Labels:
    • Environment:
      OpenJDK 64-Bit Server VM (6b24-1.11.5-0ubuntu1~12.04.1)

      Description

      This bug was introduced in org.apache.http.impl.client.cache.BasicHttpCache in 4.2.3.

      cacheAndReturnResponse takes the response and passes it to storeInCache. It then calls generateResponse with the same response resource. The problem is that storeInCache passes the resource to doGetUpdatedParentEntry, which makes a copy and deletes the resource it was passed (oldResource).

      This did not occur in 4.2.2 because in 4.2.2 doGetUpdatedParentEntry did not delete the resource. If the resource is being deleted after it is copied in 4.2.3, then it must not be used to generateResponse.

      Here is a stack trace with line numbers.

      BasicHttpCache.doGetUpdatedParentEntry(String, HttpCacheEntry, HttpCacheEntry, String, String) line: 202
      BasicHttpCache$1.update(HttpCacheEntry) line: 119
      ManagedHttpCacheStorage.updateEntry(String, HttpCacheUpdateCallback) line: 134
      BasicHttpCache.storeVariantEntry(HttpHost, HttpRequest, HttpCacheEntry) line: 128
      BasicHttpCache.storeInCache(HttpHost, HttpRequest, HttpCacheEntry) line: 96
      BasicHttpCache.cacheAndReturnResponse(HttpHost, HttpRequest, HttpResponse, Date, Date) line: 265
      CachingHttpClient.handleBackendResponse(HttpHost, HttpRequest, Date, Date, HttpResponse) line: 919
      CachingHttpClient.callBackend(HttpHost, HttpRequest, HttpContext) line: 731
      CachingHttpClient.handleCacheMiss(HttpHost, HttpRequest, HttpContext) line: 510
      CachingHttpClient.execute(HttpHost, HttpRequest, HttpContext) line: 436

        Attachments

        1. HTTPCLIENT-1299.patch
          2 kB
          James Leigh

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jamesrdf James Leigh
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: