There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-35539b53-0ece-47dc-a6d8-2d657b90c8bc XWIKI-22512 In Progress

Make sure to always return a clean document from the cache

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-d8918ebf-df47-4422-b6ff-f58b33305e97 Changes by Thomas Mortagne on 17/Sep/24 04:44
 
Description: It's easy to mess with the document in the cache for the other threads by modifying it without cloning it. Since that's a very common mistake, we should ideally find a way to fix that.

I can think of two
possibility possibilities, in XWikiCacheStore#loadXWikiDoc :
1. always return a cloned version of the
document in cache XWikiDocument
2. before returning the
document from the cache XWikiDocument , check if it was modified (XWikiDocument#isMetadataDirty) and reload it from the database if that's the case

The good thing with 1. is that it's safe, but it makes readonly uses case much slower, and it will clone the XWikiDocument twice in most (currently proper) cases. So I feel the best is 2., but we should also properly fix XWIKI-22510 and make extra sure that any modification leads to a dirty metadata flag set to true (for example, it's not the case right now for some plumbing modifications like the original document, and it's needed to cover use cases like XWIKI-22511).