Hi,

I have an major problem with one of my Drupal sites which seems to be related to the Search module; it generates queries which are running for hours, first slowing down the server (AMD Opteron, Dual Core, 2 GB RAM), then killing MySQL completely. To prevent this, I have to restart mysql on a regular basis every few hours.

Symptoms:

Queries from mytop, appearing multiple times, until max_connections is reached:

DELETE FROM search_index WHERE fromsid = 3 AND fromtype = 'node'

SELECT t.word AS realword, i.word FROM search_total t LEFT JOIN search_index i ON t.word = i.word WHERE i.word IS NULL

with times ranging from 6643 to 42541 (= time the command/thread is executing), meaning, the queries run for hours and don't go away.

If I limit max_connections in my.conf to a small number (e.g. 16) these queries from the Drupal database user exceed this limit pretty fast (resulting in Drupal outputting the "Unable to connect to database server" error due to "The MySQL error: Too many connections"; if I extend max_connections to a higher value (e.g. 250), Drupal spawns an increasing number of long-running thread (like those mentioned above) that use up all server resources, until mysqld dies.

Since the queries seem to be caused by the search module, I tried to start a full reindex. That caused no recognizable enhancement; also, I changed a few parameters in my.conf, but the default configuration seems quite stable, "tweaks" tend to worsen things. Now, I'm running out of ideas.

Any suggestions what these non-ending queries are, why they don't go away, and what I can do to prevent them to kill the server are greatly appreciated!

System configuration: Drupal 5.5, Debian "Etch", Kernel 2.6.18-4-686 (SMP), MySQL 5.0.32, PHP 5.2.0-8+etch7, Apache 2.2.3, running on an Dual-Core AMD Opteron 1212 HE, 2 GB of RAM.

Thanks & regards, -asb

Comments

chx’s picture

I can't really suggest anything just note that Drupal 6 solves this.

asb’s picture

Since I still don't know if this is a specific problem of two of my Drupal sites or a bug here just a pointer to http://drupal.org/node/134670 where other possibly fundamental problems of the search module (in regards to scalability) are discussed.

However, for me the problem remains; it goes away, as soon as I disable search module, and comes back immediately after I (re-) enable it. Drupal 6 won't be an option for many months; mabe thee are other fixes or workarounds except castrating Drupal of full text search?

Just two additions to this *absolutely critical* bug in the search modules:

* The mentioned endlessly running threads start to pop up a few minutes after the search module was enabled on one of the sites; after running for a few minutes, they consume all CPU ressources on both CPU cores.

* When allowing these dead sql queries to run longer, they start to multiply; approximately each hour a new thread is added (possibly by cron)

* When allowing them to run for some hours, the whole server becomes affected; ssh connections fail, other services stop to respond. This bug in the search module affects *the whole system* and can *crash* a webserver completely (hard reboot becomes necessary).

If this error starts to appear on your system DEACTIVATE the Search module immediately to avoid seriously damaging your server!

Greetings, -asb

Anonymous’s picture

Hi asb,

I also think somebody should come up with a fix for 5.5 - I was just upgrading _to_ 5.5 because my search was completely broken in 4.7 (even "more" than now). I think Drupal must show some professional approach here, one can't seriously put off a solution to this well-known problem from one release to another.

This may work as long as the project is not used in commercial environments and just a cms for some hobbiest, but I as a consultant would no longer recommend Drupal any longer if I knew serious bugs like this are not taken seriously by the project. And a build-in search is a fundamental, dearly needed feature for many sites. This is a quality issue.

Stephan

Anonymous’s picture

Just found a backport of some 6.x improvements on http://drupal.org/user/36148 and will test it now.

pancho’s picture

Status: Active » Closed (duplicate)

See issue http://drupal.org/node/207639. Set this to duplicate.