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

Comments

plach created an issue. See original summary.

plach’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.31 KB
marco’s picture

I worked on a few issues caused by this with plach and I agree this should be added.

plach’s picture

Issue summary: View changes
plach’s picture

StatusFileSize
new1.62 KB

Just spoke with mark and he suggested a few edits.

  • markcarver committed 9f910f6 on 7.x-2.x authored by plach
    Issue #2864718 by plach, marco: Warn developers about the risks of...
markhalliwell’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.