1

I am running magento 1.7.0.2 and I have 2 sites that both have this error message, there was a problem with this index processing.

I am not sure what effect it has on the site but I would like it fixed to be sure. When I refresh the entire group in index management the Product flat data function is the only one that will not reindex. I have tried flushing all the cache choices but I do not know what to do to fix this, can anybody please help? I am not a computer programmer so I need help in simple terms if that is possible.

Thank you for your help, however, I did what you suggested and deleted the files in the var/locks/ folder.

However, it did not help with the error message. I get this one now Can not initialize the indexer process

This is just for the "Product Flat Data" line. What else can I try to fix this? Also, is this problem causing any trouble with my website, does it matter?

Thanks again.

Steven

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (db524651933., CONSTRAINT FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (entity_id) REFERENCES catalog_product_entity )' in /homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php:228

Stack trace: #0 /homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php(228):

PDOStatement->execute(Array) #1 /homepages/16/d479755148/htdocs/ssjewels.com/lib/Varien/Db/Statement/Pdo/Mysql.php(110):

Zend_Db_Statement_Pdo->_execute(Array) #2 /homepages/16/d479755148/htdocs/ssjewels.com/app/code/core/Zend/Db/Statement.php(291):

Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3 /homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Adapter/Abstract.php(479):

Zend_Db_Statement->execute(Array) #4 /homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Adap in /homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php on line 228

Here is the result of the runindex.php file I created. I do know what it means, and I am sorry I do not know how to create a Cron job.

Thank you for your help.

2

4 Answers 4

3

your problem is the "a foreign key constraint fails" message. It means your database is damaged and you have references to entries, which dont exist anymore.

This can happen by misconfigured databases or usage of phpmyadmin for database export.

Caution, to solve this problem some knowledge is needed. Because if you make an error, you can damage your database very strong.

  1. Make a complete Backup of the database
  2. use a database tool of your choice
  3. do a truncate on the catalog_product_flat_1 table
  4. Try the reindex again
1

You can try deleting the index_process lock files via FTP.

If you login to your FTP and go here: /var/locks/ and remove all the files within this directory that should solve your problem.

EDIT: You can try run the indexing process programmatically. Create a file called runindex.php in your root folder of your Magento install and put this code in there

<?php
    require_once 'app/Mage.php';
    $app = Mage::app('admin');
    umask(0);
    for ($index = 1; $index <= 8; $index++) {
        $process = Mage::getModel('index/process')->load($index);
        $process->reindexAll();
    }
 ?>

Once you've done this you can open this up in your browser, www.yoursite.com/runindex.php

Alternatively you can re-index using a Cron job, by setting up the following Cron Command to run

php -f /home/lightin1/public_html/shell/indexer.php reindexall  
3
  • Is there any other options to try, that one did not work. Please see my post for update. Thank you.
    – sssteven
    Oct 1, 2014 at 16:23
  • I've edited my answer for you Oct 2, 2014 at 14:32
  • Chris, thanks for your help, I tried the runindex.php file and that failed miserably, look at the error message I got.
    – sssteven
    Oct 3, 2014 at 16:59
0

I was developing the magento site and while developing i seen that some issue with the magento index managment.It was asking to make index management.When i seen the index managment i can see all status as Processing.when i was trying to index it.It was not able to Index it.so i did checked the log files for this issues so i found some errors related to the some permission issues.

Warning: fopen(/index_process_8.lock) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied  in /home/prjt/public_html/app/code/core/Mage/Index/Model/Process.php on line 425
Warning: fwrite() expects parameter 1 to be resource, boolean given  in /home/prjt/public_html/app/code/core/Mage/Index/Model/Process.php on line 427
Warning: flock() expects parameter 1 to be resource, boolean given  in /home/prjt/public_html/app/code/core/Mage/Index/Model/Process.php on line 482

So i did some google and some one said please delete the locks folder in the var/locks and then i did reindexing.then the problem is solved for me.

2
  • If you're running the shell indexer script, it can run with different owner/group than the webserver runs. Running the command line indexer will create a lock file that the admin backend cannot access because its not in the same owner/group. Just deleting all the lock files in var/locks/ really is all that's necessary Sep 30, 2014 at 17:07
  • I do not know what a "shell indexer script" is, so if it isn't part of magento 1.7.0.2 then I am not running it(I think). I am not a programmer so I do not know how program actually runs in background. I deleted locks, now the error message is "Cannot initialize the indexer process". This is for only " Product Flat Data ".
    – sssteven
    Oct 1, 2014 at 16:25
0

I was not able to reindex catalog_product_flat index process. After spending a day and trying several solutions on the Internet. i was able to fix the issue. Below is the steps.

  1. Create a clone of the Magento Db which is facing the indexing issue.
  2. Dump the database into the newly created db.
  3. truncate the table catalog_product_flat_1 for single store and for multiple store there will be multiple table catalog_product_flat_* where * is the store id. Here truncate all that table.
  4. point the mangento running instance to the newly created database and configure the databse, so that site is functioning normally.
  5. Now run the command php document_root/shell/indexer.php --reindex catalog_product_flat or try reindexing from Admin. php document_root/shell/indexer.php --reindexall for reindexing all the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.