Skip to content

Redis master replica sync delay causes "Required parameter 'theme_dir' was not passed" error #40066

@hyq-csi-001

Description

@hyq-csi-001

Preconditions and environment

  • Reproduced in clean Magento version 2.4.7-p3
  • Installing and configuring Redis master and slave
Image The settings file is as follows Image

-redis master-slave synchronization delay
Simulating master-slave delay
①Cancel master-slave synchronization

Image ②Delete the db0 data from the slave database Image Image

Steps to reproduce

  1. Administrator user login backend
  2. Create a CMS block with any content
Image Image
  1. Create a CMS page and associate the content of the page with the block in step 2
  2. Open the editing screen for the CMS page you created in step 3

Expected result

  • The screen is displayed correctly and no error messages are displayed. Preview content correctly displays the contents of the CMS blocks embedded in the CMS page.
Image

Actual result

  • An error message appears. The contents of the CMS block embedded in the CMS page are not displayed.
Image

Additional information

  • Execution log:The error message "main.ERROR: Required parameter 'theme_dir' was not passed" is displayed.
Image

After investigating why the cache was deleted immediately after it was created, we found that the main cause was most likely that Redis was in a master/slave configuration (similar to a replica of the DB we are currently using).

  1. I added logging to the remove cache function to get a stack trace when the cache is deleted.
Image
  1. After obtaining the stack trace log, we were able to confirm that the cache was deleted by the \Zend_Cache_Core::save function (line 407) immediately after it was saved.
Image

The condition $data != $data2 is to check the consistency of data after it has been saved to the cache. Specifically, the cache ID is used to re-read the cache and compare it with the original data.

As a result, the original data and the data read from the cache did not match, and the target cache was deleted.

After checking the logs, we found that $data2 (data obtained from the cache) read immediately after saving to the cache was NULL.

Therefore, we believe that the translation data was too large, which meant that the Redis master-slave synchronization was not completed in time after saving to the cache, and that NULL was returned when the data was read at that time.
(This is a similar phenomenon to the common DB replica environment, where if you SELECT immediately after INSERT, the value may not yet be reflected in the replica DB and NULL may be returned.)

  • Logs for $data and $data2

$data
Image
$data2

Image

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Issue: On HoldReported on 2.4.7-p3Indicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions