State out of sync between requests

Created on 14 March 2019, over 5 years ago
Updated 20 March 2024, 3 months ago

Problem/Motivation

Drupal\Core\State uses a caching array for local caching of states. A cron running a queue is depending on this state being in sync. A second request could delete or set the state value and the queue is will still assume the old value in the static State cache.

Proposed resolution

In my opinion we should not be using a static cache for states since we depend on states being in sync between different requests or at the very least state cache should be optional. Maybe the caching part should be moved out of this class to the KeyValueStore. That way we can easily overwrite this behaviour

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡³πŸ‡±Netherlands tim_dj Netherlands

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • achap πŸ‡¦πŸ‡Ί

    Just ran into this as well with queues and static cache with state api. Workaround for those who need it is to use the keyvalue factory service directly which is what the state api is built on top of and doesn't use a static cache. Agree with #5 that it would be good to have a way of busting the cache for a particular key using state.

Production build 0.69.0 2024