-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- Reproduced in clean Magento version 2.4.7-p3
- Installing and configuring Redis master and slave


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



Steps to reproduce
- Administrator user login backend
- Create a CMS block with any content


- Create a CMS page and associate the content of the page with the block in step 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.

Actual result
- An error message appears. The contents of the CMS block embedded in the CMS page are not displayed.

Additional information
- Execution log:The error message "main.ERROR: Required parameter 'theme_dir' was not passed" is displayed.

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).
- I added logging to the remove cache function to get a stack trace when the cache is deleted.

- 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.

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

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”.