Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
16.7.1
-
None
-
Unknown
-
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 possibilities, in XWikiCacheStore#loadXWikiDoc:
1. always return a cloned version of the XWikiDocument
2. before returning the 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).
Attachments
Issue Links
- is related to
-
XWIKI-22510 XWikiDocument#isFromCache is not reliable
- Closed
-
XWIKI-22513 "Plumbing" modifications to the XWikiDocument like the version or the original document should impact the metadata dirty flag too
- In Progress
- relates to
-
XWIKI-22511 The cluster can lead to an inconsistent state of the cached XWikiDocument instance
- Closed