Ticket #12038 (closed Bug: fixed)

Opened 5 years ago

Last modified 4 years ago

plone.app.caching with plone.app.theming: Theme rules are not applied when gzip is enabled

Reported by: yomatters Owned by: ldr
Priority: minor Milestone: 4.x
Component: Diazo (plone.app.theming) Version: 4.1
Keywords: Cc:


When gzip compression is enabled in plone.app.caching, Diazo theme rules are not applied initially for anonymous users.

Steps to reproduce:

  1. Create a plone.app.theming theme.
  2. Create a new Plone site. Install the theme and plone.app.caching.
  3. In the caching configlet, import the "without caching proxy" preset.
  4. Enable caching and gzip compression.
  5. View the site as an anonymous user. The theme rules are not applied. (However, performing a hard refresh on the page causes the rules to be applied.)

Reproduced with:
Plone 4.1rc3
plone.app.caching 1.0
plone.app.theming 1.0b8

Change History

comment:1 Changed 5 years ago by kleist

  • Owner set to ldr
  • Component changed from Unknown to Diazo
  • Milestone set to 4.x

comment:2 Changed 5 years ago by ldr

  • Status changed from new to closed
  • Resolution set to invalid

You had the page cached locally in your browser, the first view returned a 304 Not Modified. When you did an unconditional GET in your hard refresh you got a themed response.

comment:3 Changed 4 years ago by eleddy

  • Status changed from closed to reopened
  • Version set to 4.1
  • Resolution invalid deleted

I just saw this bug. It is specific to the gzip setting and recreatable on a fresh cache. plone 4.1.4. diazo rules are not applied when Enable GZip compression is selected, or they are applied very inconsistently. I can toggle the behavior on and off. I don't know if it's related, but the behavior went away when the user was logged in. Anonymous + gzip whackiness.

comment:4 Changed 4 years ago by ebrehault

The problem comes from the ThemeTransform.transformIterable method.

It must return a serialized content (not an iterable) so if GZipTransform is part of the chain, it will change it in an iterable safely. GZipTransform does not actually transform the current result, it just puts a flag to enable compression, and returns the previous result in an iterable, when the previous result is a XMLSerializer (that's the case with ThemeTransform), it does not work correctly (it ends up with an empty iterator, that's why later in the chain, we just take back the non-diazoed Plone rendering).

Nevertheless I haven't been able to understand why it only happens with anonymous.

Fix and tests are here:  https://github.com/plone/plone.app.theming/pull/11

Last edited 4 years ago by ebrehault (previous) (diff)

comment:5 Changed 4 years ago by ebrehault

Actually the problem is not in GzipTransform, but later in the chain in plone.app.caching ramcache. The fix is here:  https://github.com/plone/plone.app.caching/pull/3

(the integration test is here  https://github.com/plone/plone.app.theming/pull/11)

comment:6 Changed 4 years ago by maartenkling

  • Status changed from reopened to closed
  • Resolution set to fixed

And both are merged so this is closed! :-)

Note: See TracTickets for help on using tickets.