Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-3913

When uploading a webfile content on a webfile node through JCR console manually, the cache is not invalidated.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.1.0
    • Component/s: None
    • Labels:
    • Similar issues:

      Description

      Reproduction Path

      • Create a project using hippo v11.2 archetype.
      • Add news features through Essentials and rebuild/run.
      • Visit homepage, http://localhost:8080/site/. The homepage contains a css link like the following:
        <link rel="stylesheet" href="/site/webfiles/1486145704235/css/bootstrap.css" type="text/css"/>
        
      • Hit http://localhost:8080/site/webfiles/1486145704235/css/bootstrap.css directly and see the result.
      • Open CMS Console and navigate to http://localhost:8080/cms/console/?1&path=/webfiles/site/css/bootstrap.css/jcr:content.
      • Download the jcr:data to store it into bootstrap.css in a local folder. Make some changes in the css and upload it to the jcr:data. Write changes to repository.
      • (Optional) You might want to put a debugger at org.hippoecm.hst.core.container.WebFileValve#onEvent(Event) where the property update event is supposed to be handled to invalidate the webfile cache.
        In debugger, the path variable is '/webfiles/site/css/bootstrap.css/jcr:content/jcr:data', not the webfile logical path, '/webfiles/site/css/bootstrap.css'.
            public void onEvent(final Event event) throws RepositoryException {
                final String path = event.getPath();
                final boolean remove = webFileCache.remove(path);
                if (remove) {
                    log.debug("Removed '{}' from webFileCache", path);
                }
                negativeWebFileCache.invalidate(path);
            }
        
      • Hit again http://localhost:8080/site/webfiles/1486145704235/css/bootstrap.css directly and see the result.
      • You should see the updated css webfile resource, but you cannot.
      • Even if you update the anticache timestamp in both /webfiles/site node and URL, it doesn't fix the problem.

      This bug is conflicting the statement for the Problem 4 in [1] and the intention of HSTTWO-3682, IMHO.

      Probable root cause

      • As mentioned in the optional step above, the cache key is generated as the logical representative webfile node path (e.g, '/webfiles/site/css/bootstrap.css'). However, the cache invalidation in org.hippoecm.hst.core.container.WebFileValve#onEvent(Event) doesn't infer the proper path, but simply uses any descendant node path.

      [1] https://www.onehippo.org/library/concepts/web-files/web-files-troubleshooting.html
      (It says, "You ... updated the Binary property with the upload option ...", which is exactly the same as the reproduction path. Recreating the node might be a workaround, but not so convenient for developers' loves.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wko Woonsan Ko
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: