Magento 2 How to Unlock Reindex Process: Index is locked by another reindex process Skipping
Magento 2 How to Unlock Reindex Process: Index is locked by another reindex process Skipping
During the indexing process in Magento 2, you may come across this error message: ‘Index is locked by another reindex process. Skipping’. This is quite common, either because of timeout, fatal PHP error, limited memory or disruption due to other processes. Once the process of indexing gets locked right at the reindexing time, you cannot reindex that locked index type. As a result, it will always be skipped if you try to reindex that, which can cause various inconveniences.
For instance, if the Stock index type is locked, when you reindex all the data by running this command:
php bin/magento indexer:reindex
You will see that the Stock process has been skipped in the output below:
Design Config Grid index has been rebuilt successfully in 00:00:04
Customer Grid index has been rebuilt successfully in 00:00:06
Category Products index has been rebuilt successfully in 00:00:02
Product Categories index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:01
Product EAV index has been rebuilt successfully in 00:00:00
Catalog Search index has been rebuilt successfully in 00:00:04
Stock index is locked by another reindex process. Skipping.
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00
You can reindex in the backend using this Backend Index module for free.
Therefore, in today post, I will show you how to Unlock Reindex Process: Index is locked by another reindex process Skipping step by step.
Read more about Magento 2 Indexing and Reindex
How to unlock reindex process
- Step 1: Get Index Types Info
- Step 2: Check Index Types Status
- Step 3: Reset Index Types
- Step 4: Reindex Index Types
Step 1: Get Index Types Info
The first thing which you need to do is collecting all the index types’ information/list which is present in Magento 2. In order to do that, use the following command:
php bin/magento indexer:info
After running the command above, you will receive the result like the following:
design_config_grid Design Config Grid
customer_grid Customer Grid
catalog_category_product Category Products
catalog_product_category Product Categories
catalog_product_price Product Price
catalog_product_attribute Product EAV
catalogsearch_fulltext Catalog Search
cataloginventory_stock Stock
catalogrule_rule Catalog Rule Product
catalogrule_product Catalog Product Rule
From the output, you will see the code for index type Stock
is cataloginventory_stock
.
Step 2: Check Index Types Status
In this step, what you need to do is checking the status of all the index types by using this command:
php bin/magento indexer:status
After running the command, you will see the index type Processing status Stock indicates that it is Locked. For more details, see this output
Design Config Grid: Ready
Customer Grid: Ready
Category Products: Ready
Product Categories: Ready
Product Price: Ready
Product EAV: Ready
Catalog Search: Ready
Stock: Processing
Catalog Rule Product: Ready
Catalog Product Rule: Ready
Step 3: Reset Index Types{#step-3}
To solve this problem, there is a great solution which is reset the index types which are locked. This example is in the Processing state. Run this command to reset all index types:
php bin/magento indexer:reset
Then, to reset multiple index types, run this:
php bin/magento indexer:reset IndexType1 IndexType2 IndexType3
In this case, only one index type is locked which is cataloginventory_stock
. Therefore, to unlock it, you have to run this command:
php bin/magento indexer:reset cataloginventory_stock
The result which you will receive after running the command will look like this:
Stock indexer has been invalidated.
Step 4: Step 4: Reindex Index Types
At this step, all you will have to do is check the indexer status one more time. In order to do that run the following command:
php bin/magento indexer:status
The output will look like this:
Design Config Grid: Ready
Customer Grid: Ready
Category Products: Ready
Product Categories: Ready
Product Price: Ready
Product EAV: Ready
Catalog Search: Ready
Stock: Reindex required
Catalog Rule Product: Ready
Catalog Product Rule: Ready
You can see in the output, the Stock index type has been unlocked. Besides, the status of it has been changed from Processing
to Reindex required
.
Now, the Stock index type can be reindexed by using the following command:
php bin/magento indexer:reindex cataloginventory_stock
You will receive the end result:
Stock index has been rebuilt successfully in 00:00:04
0 comments:
Post a Comment
Thanks