Hi! After searching this site for all related issues I could find and following all of the recommendations (at least the ones I could understand), I still have a problem with my search_api cron. I have a commerce kickstart 2.x (drupal7) website that has been operating (mostly) smoothly for 1.5 years, hosted by Pantheon and indexed with IndexDepot. The problem findings are as follows:

1. All of a sudden I can't index the site. It gets stuck at the "Initializing" step. It gives me the following error message:

An AJAX HTTP error occurred. HTTP Result Code: 502 Debugging information follows. Path: /batch?render=overlay&id=4318&op=do StatusText: Internal server error. ResponseText: 502 Internal server error. #page {width: 416px; padding: 10px; margin: 200px auto; border: 1px solid grey; background-color: #DFDFDF;} body {background-color: #CCC; margin: auto; font-family: Helvetica, Ariel, sans-serif;} Page Could Not Be Loaded The request could not be completed due to a networking failure.

2. Log reports "Attempting to re-run cron while it is already running"
3. Watchdog reports:

[24-Mar-2016 18:53:43 America/Los_Angeles] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/database/database.inc:2171
Stack trace:
#0 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/database/database.inc(2171): PDOStatement->execute(Array)
#1 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/database/database.inc(2350): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
#5 /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/bootstrap.inc(433): lock_acquire('schema:runtime:...')
#6 /srv/bindings/320bdbe2c8c7462db in /srv/bindings/320bdbe2c8c7462db64ed10f08017b5a/code/includes/database/database.inc on line 2171

4. cron_debug module told me all crons ran successfully except search_api and the error message says "Cron presumably failed while running the cron hook search_api_cron() in the module search_api"
5. semiclean module reports that cron is not running
6. cron is supposed to timeout after 3 minutes, but it actually runs for almost 30 minutes (all the while posting a 504 error to site visitors)
7. After doing "drush vdel cron_last" there is no change to the above problem description (and for some reason it doesn't find any cron_semaphore table)
8. Using phpmyadmin and the sql query provided on drupal.og "solving cron problems" it does not seem to be a content issue, as all my active nodes were noted as needing re-indexing (plus we haven't changed anything about the product categories)
9. My search_api_task table is only ~4000 items long (I have ~7000 active products)

If I have missed a related issue I apologize, as I know you have better things to do. I have spent >30 hours trying to solve this problem and I'm stuck (just like my cron is). I am not a developer, just a retail business owner, so if you could give me the "for dummies" instructions that would be great.

Comments

korlandi created an issue. See original summary.

korlandi’s picture

It turns out I fixed this problem by truncating the search_api_task table. I had previously tried drush commands that supposedly cleared out all cron tasks, but they did not work. The command listed here worked for me. Even though my table was only 4000 items long, it was enough to break the system. So I guess the number of items is not actually relevant - a stuck cron is a stuck cron.

http://forumone.com/blog/edge-case-solr-search-api-failed-indexing-and-c...

Please close this issue. Thanks!

drunken monkey’s picture

Status: Active » Fixed

Good to hear you resolved it on your own!
Note, though, that you're free to mark issues as "Fixed" (or any other status) yourself if you find it justified. (Especially in case of your own issues.)

sparisi’s picture

Hi Korlandi! I have the same isssues, but the link You posted is broken. Do You have command for solving this issue that You were talking about? Thank You very much!

drunken monkey’s picture

If you just want to truncate the tasks table, this is the SQL to do it: TRUNCATE search_api_task.

Via Drush: drush sqlq 'TRUNCATE search_api_task'

However, there might be important tasks in there, like deleting removed items, etc., so make sure this isn't the case, or execute those actions manually, before issuing that command.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.