This issue has been created
There are 2 updates.
 
 
Cached Code Macro / cid:jira-generated-image-avatar-2333d3cc-132f-4eff-9170-051f7170b4c1 CODECACHE-3 Open

Wrong or outdated code displayed when the content of the code macro or of the content before it is dynamic

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-ebe6cd53-780b-4e27-8048-6968ad9cb8c0 Vincent Massol created this issue on 12/Nov/26 10:27
 
Summary: Wrong or outdated code displayed when the content of the code macro or of the content before it is dynamic
Issue Type: cid:jira-generated-image-avatar-2333d3cc-132f-4eff-9170-051f7170b4c1 Bug
Affects Versions: 1.0, 1.0.1
Assignee: Unassigned
Created: 12/Nov/26 10:27
Priority: cid:jira-generated-image-static-major-5c5b9b78-0c0b-4c97-8459-4ed142c6f3d2 Major
Reporter: Vincent Massol
Description:

The result of a code macro is cached under an id made only of the reference of the document containing the macro and of the position of the macro block in the rendered XDOM. Neither the macro content nor its parameters are part of that id, which leads to wrong content being displayed:

  • Content generated by a script: when the content of the code macro is produced by a script (see the example below), the first rendered result is cached and then displayed to every other user and request, until the page is modified.
  • Content placed before the macro changes: the position of the macro block is computed after the macros executed before it (e.g. script macros) have inserted their result in the XDOM. When that result varies (per user, per request parameter, over time), a code macro can get the position that another code macro of the same page had in a previous rendering, and the highlighted content of that other code macro is displayed instead.
  • No source document: when the content is rendered without any source document information (e.g. a string rendered from a script), all such code macros share cache entries based on their position only, and those entries are never invalidated.

Steps to reproduce

  1. Create a page with the following content:
    {{velocity}}
    {{code}}$xcontext.user{{/code}}
    {{/velocity}}
    
  2. View it as user A, then as user B

Expected

User B sees their own user reference.

Actual

User B sees user A's reference.

 
 

2 updates

 
cid:jira-generated-image-avatar-ebe6cd53-780b-4e27-8048-6968ad9cb8c0 Changes by Vincent Massol on 12/Nov/26 10:27
 
Fix Version: 1.1
Assignee: Vincent Massol