Sometimes bin/magento indexer:status shows an indexer as Processing for hours, and catalog changes stop appearing on the storefront. The indexer is not working hard. It is stuck.
What it looks like
- An indexer shows “Processing” long after any reindex should have finished.
- New prices, stock changes or products do not appear on the storefront.
- Running
bin/magento indexer:reindexfor that indexer does nothing, or says it is already running.
Why it happens
When a reindex starts, Magento marks the indexer as processing. When it finishes, it clears the flag. If the process dies halfway, for example from a PHP fatal error, running out of memory, a killed process or a server restart, nothing clears the flag. Magento skips any indexer that is already marked as processing, so every later reindex skips it too.
Confirm it
bin/magento indexer:status
Look for indexers in “Processing” when no reindex is actually running. You can check for a running reindex with ps aux | grep indexer.
How to fix it
Reset the indexer, which clears the stuck flag, and then rebuild it. Replace the code with your stuck indexer:
bin/magento indexer:reset catalog_product_price
bin/magento indexer:reindex catalog_product_price
On a large catalog the reindex can take several minutes. The storefront shows correct data as soon as it finishes.
Find what killed the first run
If you only reset it, it will get stuck again next time the same thing happens. Look in var/log/exception.log and var/log/system.log around the time the indexer got stuck. The usual causes are:
- Memory limit: run large reindexes with more memory, for example
php -d memory_limit=4G bin/magento indexer:reindex. - A timeout or killed process: long reindexes started from a web request or a short-lived SSH session can be cut off. Run them from cron or in
screen/tmux. - A broken extension that hooks into indexing and throws an exception for certain products.
Catch it automatically
MageMonitor checks for this every few minutes as part of its Magento health checks, and alerts you by email, Slack or webhook the moment it appears, with the exact commands to fix it. See MageMonitor for Magento 2.
