<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>17820</bug_id>
          
          <creation_ts>2012-07-18 06:55:00 +0000</creation_ts>
          <short_desc>appcache: avoid out-of-sync situations or cache busting when using appcache with non-sticky load balancers</short_desc>
          <delta_ts>2015-08-13 08:03:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>blocked awaiting response to comment 11 (please remove this when replying)	</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>slightlyoff</cc>
    
    <cc>tobie.langel</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70110</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 06:55:00 +0000</bug_when>
    <thetext>This was was cloned from bug 15771 as part of operation convergence.
Originally filed: 2012-01-29 11:30:00 +0000
Original reporter: Tobie Langel &lt;tobie.langel@gmail.com&gt;

================================================================================
 #0   Tobie Langel                                    2012-01-29 11:30:14 +0000 
--------------------------------------------------------------------------------
Use case / explanation: 

An application is hosted on a cluster of servers behind a non-sticky load
balancer. It is updated daily. Even though all servers are not updated
instantly and two versions of the application co-exist for a while, it is
possible to update the application without risking to have an out-of sync
version of the application (e.g. manifest file and assets of the latest version
combined with a Master Entry of the previous version) or to need to invalidate
the cache to avoid such issues.
================================================================================</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74561</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-26 18:21:13 +0000</bug_when>
    <thetext>How is this problem solved when you&apos;re not using appcache?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76038</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-11 21:24:39 +0000</bug_when>
    <thetext>Tobie: Please see the question in comment 1 and reopen the bug. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78437</commentid>
    <comment_count>3</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2012-11-17 10:40:47 +0000</bug_when>
    <thetext>This is generally done by adding a timestamp or checksum to resource URLs and serving them from a CDN (which can host resources from multiple versions of the application).

This technique doesn&apos;t work when using AppCache because neither the master entry nor the manifest can have their URL fingerprinted. So which master entry and/or manifest end-up being picked up during update is non-deterministic.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82609</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-02-06 00:33:01 +0000</bug_when>
    <thetext>I don&apos;t understand how it&apos;s solved with fingerprinted URLs.

Say you have two CDNs, A and B.

Initially, A and B both fold the same files:

  A                 B
  index.html (v1)   index.html (v2)
  script.js?v1      script.js?v1
  style.css?v1      style.css?v1

Obviously, index.html here refers to both script.js?v1 and style.css?v1.

Now, a new version of index.html, script.js, and sytle.css are pushed out. A gets the files first, so now A has an index.html that refers to v2 files, and it also has the v2 files, but B still has the old index.html:

  A                 B
  index.html (v2)   index.html (v1)
  script.js?v1      script.js?v1
  style.css?v1      style.css?v1
  script.js?v2
  style.css?v2

What happens if you hit A for index.html, and B for &quot;script.js?v2&quot;?

Or am I misunderstanding the issue here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109449</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-29 00:04:10 +0000</bug_when>
    <thetext>Tobie, can you elaborate? See comment 4. Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109470</commentid>
    <comment_count>6</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2014-07-29 08:48:21 +0000</bug_when>
    <thetext>Yeah, sorry.

All the assets are hosted on a CDN. So the CDN hosts:

    script.v1.js
    style.v1.css
    script.v2.js
    style.v2.css

And so the issue of hitting a server for a missing resource never arrises (as long as you prime the CDN before you start updating your servers).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109502</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-29 16:50:32 +0000</bug_when>
    <thetext>Tobie: So the problem is that you can&apos;t push both the index.html file and the manifest file to the CDN at the same time atomically?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109508</commentid>
    <comment_count>8</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2014-07-29 17:18:33 +0000</bug_when>
    <thetext>Right, that was the issue at Facebook. App was updated daily, then, and propagation across the clusters took &gt; 1 hour.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111194</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-08 21:12:09 +0000</bug_when>
    <thetext>So basically, the problem is that traditionally, there&apos;s one file that has the list of resources (index.html), while with appcache, there must be two files: the index and the manifest. If you can&apos;t update them atomically, then they might reference different subresources. One lame solution would be have an intermediate manifest that listed all the files from both versions. So they you&apos;d deploy as follows:

   - deploy new resources (script.v2.js, etc)
   - wait for that to be done
   - deploy new manifest that contains both v1 and v2 resources
   - wait for that to be done
   - deploy new index.html
   - wait for that to be done
   - deploy new manifest that contains only v2 resources
   - wait for that to be done
   - undeploy v1 resources</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111196</commentid>
    <comment_count>10</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2014-09-08 21:35:56 +0000</bug_when>
    <thetext>I can&apos;t really imagine that happening, frankly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111283</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-09 16:15:13 +0000</bug_when>
    <thetext>Well like I said, it&apos;s a lame solution.

I&apos;m not really sure what a better solution would be, though. Do you have any suggestions?

Alex, does ServiceWorkers have a solution for this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122576</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-08-13 07:08:26 +0000</bug_when>
    <thetext>Sorry, appcache will no longer be maintained.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122578</commentid>
    <comment_count>13</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2015-08-13 08:03:57 +0000</bug_when>
    <thetext>What terrible news. :grin:</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>