Hi there!

I'm running 6.x2.0-alpha2 on Drupal 6.15 and the apachesolr_search is failing when it tries to index the content.

At first cron.php was failing to complete, which I traced it to this module.

Then I tried the Batch reindex.

This fails with:

An HTTP error 0 occurred. /batch?id=151&op=do

and invites me to the error page which says:

An error occurred while processing apachesolr_batch_reindex_process with arguments :apachesolr_batch_reindex_process

There is then an 'access denied' warning in the watchdog, so I am not sure if the batch failure is related to the cron.php failure or not.

When installing I made sure that I copied the schema.xml and solrconfig.xml from the module directory to the solr/conf directory - and the Search index page reports: Using schema.xml version: drupal-0.9.4

And the settings page shows:
Apache Solr: Your site has contacted the Apache Solr server.
Apache Solr PHP Client Library: Correct version "Revision: 22".

It is not generating any errors in the php error log.

Any suggestions on how to further debug the problem would be warmly welcomed.

Many thanks.

Comments

Chris Charlton’s picture

subscribing

janusman’s picture

We've seen this happening and (I think) one of the common causes is some "bad" node object causing problems during indexing.

One way to trace this is to reduce the number of nodes indexed per cron call to the minimum and run cron to see when it fails. Then you might have the "bad" node on that batch. The batch is determined by apachesolr_get_nodes_to_index(); you might add some debugging into that function to show what nodes are being sent to be indexed.

finn lewis’s picture

Thanks for your reply janusman.

I will try the debugging with the apachesolr_get_nodes_to_index()

I have several content types, and was only trying to index the one particular type by excluding all others with the 'Types to exclude from the search index' options on the 'content bias settings' page.
This still exhibited the same behaviour.

I resorted to testing the same code and database on my local setup, still connecting to the apache solr instance on the server, and it worked as expected. Both cron and the batch re-index did what they were supposed to. So I then rsynced all the files to another server, dumped the same database, and continued to use the apache solr on the original server, and it worked again, indexing nodes as expected. Finally I decided to set up Apache Solr on the new server, and crack on with the development I was supposed to be doing.

So it seems it is not an issue with the Solr instance, and not necessarily with the module code, but something more environmental, possibly php configuration? The truth is I simply don't know as there are no helpful log entries.

For the record, the PHP versions are as follows:

- troubled server: PHP 5.2.0-8+etch16.
- locally, working fine: PHP 5.2.6
- 2nd server, working fine: PHP 5.2.6-1+lenny4

I am not saying that this is a PHP version issue, I am just leaving as much information as possible in case this happens to anyone else.

Thanks again for the module, it is beautiful once it's all working!

drewish’s picture

Any fatal error will stop the indexing. My guess is that you're running out of memory. Try lowering the number of nodes you're indexing in a cron run (this number also affects the size of the batch operations). You might have to do it in several steps: check the remaining count, try running cron, if it didn't change, lower the number, run cron, etc.

flk’s picture

Priority: Normal » Critical

I have similar issue which i came across yesterday whilst trying to update the index.
I have tried both version 1 and 2 but alas cron fails as soon as I enable the apache_search module (without it the cron runs fine albeit no content is indexed.

I tried running the cron code from cli and, it seems to return the array fine but as soon as it is passed to the 'apachesolr_index_nodes' a 'Segmentation fault' occurs :/

Below is the code I used as well as the output

#!/usr/bin/php
<?php
chdir(dirname($_SERVER['argv'][0]));
include_once('./includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
ini_set('memory_limit', '1024M');
ini_set('max_execution_time','180');

$cron_limit =5;
$rows = apachesolr_get_nodes_to_index('apachesolr_search', $cron_limit);
var_dump($rows);
apachesolr_index_nodes($rows, 'apachesolr_search');
?>

The output I get is as follows:

hop@dev:~/public_html/upgrade/htdocs$ ./solrindex.php.sh 
array(5) {
  [0]=>
  object(stdClass)#322 (2) {
    ["nid"]=>
    string(4) "4270"
    ["changed"]=>
    string(10) "1244040112"
  }
  [1]=>
  object(stdClass)#324 (2) {
    ["nid"]=>
    string(4) "4273"
    ["changed"]=>
    string(10) "1244040549"
  }
  [2]=>
  object(stdClass)#325 (2) {
    ["nid"]=>
    string(4) "4268"
    ["changed"]=>
    string(10) "1244040655"
  }
  [3]=>
  object(stdClass)#326 (2) {
    ["nid"]=>
    string(4) "4275"
    ["changed"]=>
    string(10) "1244041409"
  }
  [4]=>
  object(stdClass)#327 (2) {
    ["nid"]=>
    string(4) "4277"
    ["changed"]=>
    string(10) "1244041586"
  }
}
Segmentation fault

My setup is as follows:

Web server:          Apache/2.2.3 (Debian) PHP/5.2.0-8+etch16
MySQL database:	   5.0.32
PHP:	                   5.2.0-8+etch16
PHP memory limit: 512M
ChrisFlink’s picture

See http://drupal.org/node/719356 for the patch that fixed the apachesolr + PHP 5.2.0-8+etch16 problem for me.
"flk" confirmed that that patch worked for him!

jpmckinney’s picture

Priority: Critical » Normal

Leaving issue open as it is common, but downgrading to normal.

heavy_engineer’s picture

I experienced this issue on D6.16, PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 on Ubuntu 9.10 - i tried all the above and the link to the patch and nothing worked. It definitely wasnt However, i did find an error relating to a pcre library and upon further investigation this was found to be an issue with the ubuntu compiled php.

So, i purged the ubuntu php, downloaded php-5.2.13, compiled, restarted apache2 (using the stock apache2) and its working fine now.

Hope this helps someone.

pwolanin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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