Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento index status pending forever

I've created a Magento instance via command line and added a few products. Right after, started the re-index proccess for every indexes. The current situation is that all indexes have status pending/processing. This situation brings me a few questions:

  1. Is there any relation between this problem and the installation process? (via command line)
  2. Is it a problem? Since I didn't have noticed any side effect I'm not very concerned about it. Unless if it's spending tons of unnecessary processing.
  3. How can I fix it?

I've already executed php shell/indexer.php reindexall but nothing changed. And, if I execute php shell/indexer.php --status all indexes report as 'Pending'.

Thanks

like image 226
MatheusJardimB Avatar asked Dec 31 '13 17:12

MatheusJardimB


2 Answers

First: You'll want to get your terminology straight. (it can be a little confusing). A Magento index has one of three statuses.

pending
working
require_reindex

You can see the constants for these statuses here

const STATUS_RUNNING            = 'working';
const STATUS_PENDING            = 'pending';
const STATUS_REQUIRE_REINDEX    = 'require_reindex';

This can be confusing because the image Magento uses to represent these statuses use different terminology.

enter image description here

That is, when an index has a status of pending, Magento's UI represents this as Ready. When an index has a status of working, Magento's UI represents this as Processing, etc.

Further confusing things, the indexer.php command does not use this terminology -- instead it uses terms closer to the actual status

Pending
Require Reindex
Running

So, when you're saying Pending/Processing above, it's not clear what state your system is in.

Second: PHP does not have a built in queuing system — that means each index runs in an individual PHP process. This also means Magento and PHP have no (easy, reliable) way to determine if an index process is running. In order to implement the STATUS_RUNNING/Working/Running status, Magento uses lock files to keep track of an index's status. These lock files are located in

var/locks/index_process_*

When an index is "stuck" in STATUS_RUNNING/Working/Running for longer than you'd expect, it's usually because

  1. A indexer request quit half way though, and failed to clean up its log files

  2. The permissions of the files in var/locks/index_process_* are such that PHP can't write the files

Re: #2 -- If you're in the habit of using the command line indexer, you can often end up creating files that Magento, when running from the web-server/web-admin, won't be able to edit or delete. Deleting these files and then reindexing is often the best way to fix this problem.

like image 63
Alan Storm Avatar answered Oct 19 '22 10:10

Alan Storm


in var/locks folder delete the .lock file which was created.

This will e the first step in solving.

Also check if php execution time and memory limit are not the reason for indexing script not completing its execution.

like image 1
Oscprofessionals Avatar answered Oct 19 '22 09:10

Oscprofessionals