Skip to content

Set STATE_INITIALISING before loading config #68 #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025

Conversation

bwalkerl
Copy link
Contributor

@bwalkerl bwalkerl commented Apr 11, 2025

Resolves #68

The root cause of this issue is essentially:

  • Forcedcache initialises stores to test if the forced cache will work https://github.com/catalyst/moodle-tool_forcedcache/blob/MOODLE_405_STABLE/classes/cache_config.php#L239
  • MDL-80815 added di::get(clock::class) to the initialisation of redis cache (main only)
  • Calling that initialises di, which initialises hookcallbacks, which make use of caching
  • When trying to create the definition it fails $instance->get_definition_by_id once which has debugging output we see
  • Debugging output this early breaks session_set_save_handler(), which is fatal if you don't have an existing session.

The solution appears to be setting STATE_INITIALISING to use ad-hoc cache for that request.

This is done in the core cache factory and should be relatively safe as $this->updating_finished() will set it to STATE_READY when finished. It was originally removed as part of #11 so we might want to double check the mentioned edge caches.

@Peterburnett Peterburnett merged commit a8ee9d6 into MOODLE_405_STABLE May 15, 2025
14 checks passed
@Peterburnett Peterburnett deleted the 68-cache-definitions branch May 15, 2025 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache definitions reparsed causing cache reset in order to locate definition.
2 participants