Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
search.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2009 at 20:22 UTC
Updated:
13 Oct 2009 at 05:23 UTC
Here is a host with replicatable errors
console 2 run http://drupalbin.com/10206
http://drupalbin.com/10203 on mine server
http://drupalbin.com/10204 on AWS
Comments
Comment #1
Amazon commentedOn the same site, I ran simpletest from the UI.
http://drupalbin.com/10207
SSH keys and logins are available. Just ask in #drupal-infrastructure.
Comment #2
damien tournoud commentedCare to identify the test cases that are failing?
Comment #3
andypostI have stable fault on test system->Cron Run
http://php.net/manual/en/function.set-exception-handler.php
In comments I found mostly happens when exception raised inside exception handler
Comment #4
andypostSo when I run from console scrups/run-tests.sh
Suppose, exception just breaks batch, because result - tests passed
Comment #5
boombatower commentedI'm really not sure what the issue is, can someone provide a bit more detail...seems like it changed from the original thought.
Comment #6
philipnet commentedTest “System -> Cron run” fails with an exception; the message returned is:
Test “System -> Trigger cron (system) actions” fails with an exception; the message returned is:
Both tests call drupal_cron_run at least once; this instigates the Exception thrown later on in the DBTNG environment, see below for how I arrived at this.
For both of these, the function calling hierarchy is: drupal_cron_run -> module_invoke_all('cron') -> call_user_func_array -> search_cron -> register_shutdown_function('search_update_totals');
search_update_totals -> db_query("... {search_total} ...");
Cron is calling the module's _cron functions, but is falling over on the Search module as that module hasn't been enabled.
I'm looking in function module_implements(); plugging the SQL into mysql via the CLI:
SELECT * FROM registry WHERE type = 'function' AND suffix = "cron";
If I put:
if ($hook=='cron') { var_dump($implementations[$hook]); }in modules.inc at line 387, it prints:
array(5) {
[0]=>
string(5) "dblog"
[1]=>
string(6) "filter"
[2]=>
string(4) "node"
[3]=>
string(6) "search"
[4]=>
string(6) "system"
}
I don't understand why 'search' is returned and 'update' isn't.
At least
db_query ("SELECT * FROM {does_not_exist}");throws an exception with helpful text and file names with line numbers.
Can anyone replicate what I've produced above and help clear the fog my brain as to why it's happening?
Comment #7
stuzza commentedI can replicate it, though I can't shed any further light.
Bizarrely, the same query, when run directly before module_implements() is called, returns:
but within module_implements() it returns the result philipnet mentioned above. I don't believe caching is a factor as I've got module_implements() purging its cache to automatically. It's as if the registry table is changed 'magically' each time the function module_implements() is invoked with the 'cron' hook.
Comment #8
stuzza commentedI've done some more fossicking. In modules/simpletest/drupal_web_test_case.php DrupalWebTestCase::setUp() installs modules from the default profile, including search. I had Drupal installed using the expert ('Drupal (minimal)') profile and I found when reinstalling with the default profile I no longer got the error.
I understand that testing against the default profile makes sense (you have to test against some sort of defined environment) but this testing doesn't seem to be working when the underlying platform has been installed with a different profile.
My colleague Josh Waihi suggests there might be DrupalWebTestCase::preloadRegistry() might be part of the problem.
Comment #9
josh waihi commentedTo extend what @stuzza is saying, this problem only occurs when testing in Expert mode, because, as it would seem, simpletests assumes the parent database is in a state that reflects the default install profile and tries to cut performance corners by copying the registry from from the parent database (I think with ->preloadRegisty). If this is the case, then when need to either make the default profile modules dependencies of the simpletest module or not steal the registry state from the parent database, which seems like a better idea to me.
Thinking about it a bit more, why not create a drupal install with a prefix like 'st_model' and steal the registry from that rather than the parent - It could also be useful for stealing other bits and pieces.
Comment #10
philipnet commentedIn that case, this need re-assigning.
Comment #11
damien tournoud commentedThis has nothing to do with the registry or simpletest. It's just that the search module is registering a shutdown function when run into the child site, but this function fails because at the time when it is executed, the child site has already been destroyed.
Let's just add a try / catch in search_update_totals().
Comment #12
deekayen commentedIs this error showing on servers with php5-suhosin installed? Seems like that was the cause for me. Haven't been able to reproduce this on MySQL 5.0 MyISAM and InnoDB or MySQL 5.1 MyISAM, so I'm removing the blocker tag.
Comment #13
philipnet commentedIt showed up on my test server which /didn't have/ suhosin installed.
But I doubt it's a PIFR 2 blocker as it only manifests if the user invokes the tests from an existing Drupal 7 installation where the Search module is not enabled (AIUI).
Comment #14
chx commented#602958: Running cron does not end well