magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Indexer deferred cache's not being flushed by commit or nesting issue #39027

Open elevinskii opened 1 month ago

elevinskii commented 1 month ago

Preconditions and environment

Magento 2.4.6-p6

Cron jobs, responsible for reindexing tasks, are primarily using DeferredCacheContext for collecting tags and entities for cache flushing and further process them later at once.

The cache context object has an internal pointer of nesting, and pushes registered tags/entities only if the pointer is equal to 1. That's understandable, having nesting hierarchy logics, only last commit must take the action.

What will happen if some of cron jobs finish erroneously with doing start and incrementing the level pointer but never commiting?

Steps to reproduce

  1. Make indexer_reindex_all_invalid cron job to fail every time (throw an exception in the job).
  2. Do some changes in a products to put them to partial reindex queue.
  3. Keep an eye what cache tags have been invalidated in the var/log/cache.log after cron runs.

Expected result

Every product/related categories tags, such as cat_p_*, cat_c_* are pushed for invalidation.

Actual result

No cache tags are invalidated by partial cron reindex.

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @elevinskii. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 week ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 week ago

Hello @elevinskii,

Thanks for the report and collaboration!

We have gone through the DeferredCacheContext class and we agree with your point. Hence we are confirming the issue for further processing.

Thanks

github-jira-sync-bot commented 1 week ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12884 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 week ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.