Sometimes indexing hangs at "initializing" after restarting indexing that stopped for some error.

The php cpu usage jumps to 100%, and the mysql db has some sleeping query that hangs as well. When I kill that query I get a long error message like this:
Unsure why Search API is trying to select a revision when I dont have any revisions selected in the Fields section.

I will try to collect more info why this happens. I wonder if I may have a malformed entity somewhere that causes this.

Indexing a maximum number of 3675720 items (50 items per batch run)  [ok]
for the index Test.
exception 'PDOException' with message 'SQLSTATE[HY000]: General      [error]
error: 2006 MySQL server has gone away' in
..../includes/database/database.inc:2171
Stack trace:
#0 ..../includes/database/database.inc(2171):
PDOStatement->execute(Array)
#1 ..../includes/database/database.inc(683):
DatabaseStatementBase->execute(Array, Array)
#2 ..../includes/database/select.inc(1265):
DatabaseConnection->query('SELECT revision...', Array, Array)
#3 ..../includes/entity.inc(198):
SelectQuery->execute()
#4 ..../includes/common.inc(7919):
DrupalDefaultEntityController->load(Array, Array)
#5
..../sites/all/modules/entity/includes/entity.wrapper.inc(7                                                                                                                                                             15):
entity_load('commerce_produc...', Array)
#6
..../sites/all/modules/search_api/search_api.module(2217):
EntityDrupalWrapper->value(Array)
#7
..../sites/all/modules/search_api/includes/index_entity.inc                                                                                                                                                             (499):
search_api_extract_fields(Object(EntityDrupalWrapper), Array)
#8
..../sites/all/modules/search_api/search_api.module(1531):
SearchApiIndex->index(Array)
#9
..../sites/all/modules/search_api/search_api.module(1487):
search_api_index_specific_items(Object(SearchApiIndex), Array)
#10
..../sites/all/modules/search_api/search_api.module(2969):
search_api_index_items(Object(SearchApiIndex), '50')
#11 [internal function]:
_search_api_batch_indexing_callback(Object(SearchApiIndex), '50',
3990598, true, Object(DrushBatchContext))
#12 /usr/local/src/drush/commands/core/drupal/batch.inc(149):
call_user_func_array('_search_api_bat...', Array)
#13 /usr/local/src/drush/commands/core/drupal/batch.inc(101):
_drush_batch_worker()
#14 /usr/local/src/drush/includes/batch.inc(90):
_drush_batch_command('2700')
#15 /usr/local/src/drush/commands/core/core.drush.inc(1168):
drush_batch_command('2700')
#16 [internal function]: drush_core_batch_process('2700', '2700')
#17 /usr/local/src/drush/includes/command.inc(368):
call_user_func_array('drush_core_batc...', Array)
#18 /usr/local/src/drush/includes/command.inc(219):
_drush_invoke_hooks(Array, Array)
#19 [internal function]: drush_command('2700', '2700')
#20 /usr/local/src/drush/includes/command.inc(187):
call_user_func_array('drush_command', Array)
#21 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(62):
drush_dispatch(Array)
#22 /usr/local/src/drush/drush.php(70):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#23 /usr/local/src/drush/drush.php(11): drush_main()
#24 {main}
The external command could not be executed due to an application     [error]
error.
CommentFileSizeAuthor
#4 Screen Shot 2016-03-21 at 00.00.45.png1.02 MBkenorb

Comments

drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)

Please try to find out more, yes (especially whether a certain entity causes the problem, or whether lowering the indexing limit or batch size helps). Currently, it's hard to guess at possible causes.
(If you managed to solve it, please mark as fixed, and maybe explain shortly what happened so others might benefit from it.)

giorgio79’s picture

Issue summary: View changes

Thanks Thomas. I have not seen this in a while. What I remember is that creating a brand new index seems to have solved the problem, and some items were just taking ages to index.

kenorb’s picture

Version: 7.x-1.14 » 7.x-1.17
Status: Postponed (maintainer needs more info) » Active
kenorb’s picture

kenorb’s picture

kenorb’s picture

Status: Active » Postponed (maintainer needs more info)
Related issues: +#2408727: Better handling of large numbers of tasks

I've similar issue the indexing is stuck on Initializing when run from UI. But this is rather related to #2408727: Better handling of large numbers of tasks.

legolasbo’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

This issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.