Problem/Motivation
I just fixed a subtle bug in a project I'm working on concerning the JS module and caching: if a callback is configured to run at a bootstrap level lower than FULL (the default case), only certain module hooks are executed based on the configured dependencies; this may cause corrupt cache entries to be stored. For instance, when calling entity_load() with cold caches, only the additions provided by the loaded modules are stored in the entity cache entry. That way the entity cache the entity cache entry ends up missing pieces and the corrupt state lasts until cache is cleared and the entity is loaded in a fully-bootstrapped request. In our case we were seeing nodes apparently losing their field values and a subsequent save would lead to data loss.
Proposed resolution
Add some documentation to make clear that callbacks interacting with APIs the can perform a storage write should be aware of this risk and possibly run at full bootstrap level.
Remaining tasks
- Validate solution
Write a patch- Reviews
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | js-cache_docs-2864718-3.patch | 1.62 KB | plach |
| #2 | js-cache_docs-2864718-2.patch | 1.31 KB | plach |
Comments
Comment #2
plachComment #3
marco commentedI worked on a few issues caused by this with plach and I agree this should be added.
Comment #4
plachComment #5
plachJust spoke with mark and he suggested a few edits.
Comment #7
markhalliwell