Ubuntu server (10.04 and 12.04)
MySQL
Drupal 7.14
Apachesolr current -dev

On a clean install with apachesolr enabled, no simpletests can run. I've attached the output from drush

Comments

nick_vh’s picture

Status: Active » Postponed (maintainer needs more info)

That is odd since the test-bot in drupal.org runs perfectly... I've tested it again and it seems to work. Will see if I can manage to test it through drush.
I would need more info from you, have you tested it through the UI? Does that work?

fearlsgroove’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new2.71 KB

Here's a more complete (and useful) stack trace. The error originates in apachesolr_hook_info_alter's call to entity_get_info()

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dev_drupal.simpletest87395node_type' doesn't exist in [path-to-web]/includes/database/database.inc on line 2136

Call Stack:
    0.0107     652872   1. {main}() [path-to-web]/index.php:0
    0.4516   65813432   2. menu_execute_active_handler(???, ???) [path-to-web]/index.php:21
    0.4584   67186128   3. call_user_func_array(???, ???) [path-to-web]/includes/menu.inc:516
    0.4584   67186496   4. system_batch_page() [path-to-web]/includes/menu.inc:516
    0.4584   67186496   5. _batch_page() [path-to-web]/modules/system/system.admin.inc:2353
    0.4585   67190696   6. _batch_do() [path-to-web]/includes/batch.inc:80
    0.4585   67190696   7. _batch_process() [path-to-web]/includes/batch.inc:161
    0.4598   67332112   8. call_user_func_array(???, ???) [path-to-web]/includes/batch.inc:284
    0.4598   67332184   9. _simpletest_batch_operation(???, ???, ???) [path-to-web]/includes/batch.inc:284
    0.4660   68767768  10. DrupalTestCase->run(???) [path-to-web]/modules/simpletest/simpletest.module:177
    0.4670   68801328  11. DrupalWebTestCase->setUp() [path-to-web]/modules/simpletest/drupal_web_test_case.php:496
    1.7951   65160064  12. file_prepare_directory(???, ???) [path-to-web]/modules/simpletest/drupal_web_test_case.php:1316
    1.7952   65160144  13. file_stream_wrapper_valid_scheme(???) [path-to-web]/includes/file.inc:435
    1.7952   65160144  14. file_stream_wrapper_get_class(???) [path-to-web]/includes/file.inc:220
    1.7952   65160144  15. file_get_stream_wrappers(???) [path-to-web]/includes/file.inc:183
    1.7952   65160448  16. module_invoke_all(???) [path-to-web]/includes/file.inc:127
    1.7953   65161072  17. module_implements(???, ???, ???) [path-to-web]/includes/module.inc:820
    1.7966   65169856  18. module_hook_info() [path-to-web]/includes/module.inc:678
   21.7135   65474824  19. apachesolr_hook_info_alter(???) [path-to-web]/includes/module.inc:752
   77.8574   65489640  20. entity_get_info(???) [path-to-web]/sites/all/modules/apachesolr/apachesolr.module:2177
   99.0893   65624520  21. module_invoke_all(???) [path-to-web]/includes/common.inc:7455
   99.0913   65635552  22. call_user_func_array(???, ???) [path-to-web]/includes/module.inc:823
   99.0913   65635920  23. comment_entity_info() [path-to-web]/includes/module.inc:823
   99.0913   65641336  24. node_type_get_names() [path-to-web]/modules/comment/comment.module:118
   99.0913   65641336  25. _node_types_build(???) [path-to-web]/modules/node/node.module:438
   99.0955   65707912  26. SelectQuery->execute() [path-to-web]/modules/node/node.module:703
   99.1000   65712088  27. DatabaseConnection->query(???, ???, ???) [path-to-web]/includes/database/select.inc:1264
fearlsgroove’s picture

Yes i've tried through both the UI and through drush

fearlsgroove’s picture

Just putting a try/catch around the entity_get_info call prevents the simpletest crash for me. This issue only started when we updated to 7.14.

Despite allowing the actual test to finish, we still get an error such as:
Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array
.. until we clear the cache after running apachesolr tests. I've seen a similar issue in the queue on that, but I wonder if it's related. Note this doesn't require that we run an apachesolr test -- any test will do.

[Edit:] Thanks for the quick reply!

kenorb’s picture

The same problem.

$ drush test-run ViewsCacheTest
<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;aat_clean.simpletest297647node_type&amp;#039; doesn&amp;#039;t exist: SELECT nt.*
FROM 
{node_type} nt
WHERE  (disabled = :db_condition_placeholder_0) 
ORDER BY nt.type ASC; Array
(
    [:db_condition_placeholder_0] =&amp;gt; 0
)
 in _node_types_build() (line 703 of /Users/kenorb/Sites/AAT/docroot/modules/node/node.module).</p><h2>Additional</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;aat_clean.simpletest297647watchdog&amp;#039; doesn&amp;#039;t exist: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array
(
    [:db_insert_placeholder_0] =&amp;gt; 0
    [:db_insert_placeholder_1] =&amp;gt; php
    [:db_insert_placeholder_2] =&amp;gt; %type: !message in %function (line %line of %file).
    [:db_insert_placeholder_3] =&amp;gt; a:6:{s:5:&amp;quot;%type&amp;quot;;s:12:&amp;quot;PDOException&amp;quot;;s:8:&amp;quot;!message&amp;quot;;s:282:&amp;quot;SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;amp;#039;aat_clean.simpletest297647node_type&amp;amp;#039; doesn&amp;amp;#039;t exist: SELECT nt.*
FROM 
{node_type} nt
WHERE  (disabled = :db_condition_placeholder_0) 
ORDER BY nt.type ASC; Array
(
    [:db_condition_placeholder_0] =&amp;amp;gt; 0
)
&amp;quot;;s:9:&amp;quot;%function&amp;quot;;s:19:&amp;quot;_node_types_build()&amp;quot;;s:5:&amp;quot;%file&amp;quot;;s:56:&amp;quot;/Users/kenorb/Sites/AAT/docroot/modules/node/node.module&amp;quot;;s:5:&amp;quot;%line&amp;quot;;i:703;s:14:&amp;quot;severity_level&amp;quot;;i:3;}
    [:db_insert_placeholder_4] =&amp;gt; 3
    [:db_insert_placeholder_5] =&amp;gt; 
    [:db_insert_placeholder_6] =&amp;gt; http://default/index.php
    [:db_insert_placeholder_7] =&amp;gt; 
    [:db_insert_placeholder_8] =&amp;gt; 127.0.0.1
    [:db_insert_placeholder_9] =&amp;gt; 1336664545
)
 in dblog_watchdog() (line 154 of /Users/kenorb/Sites/AAT/docroot/modules/dblog/dblog.module).</p><hr />Drush command terminated abnormally due to an unrecoverable error.                                                                                                                             [error]

Disabling temporary apachesolr, the error disappears.

edb’s picture

I just ran into the same problem. I dug a little and it looks like this could be the same issue as #1410256: apachesolr_hook_info() calls entity_get_info() which can throw an error when installing using a profile.

For a quick temporary fix it is possible to wrap the call to entity_get_info() in a try-catch block

Line 2172 apachesolr.module

/**
 * Implements hook_hook_info_alter().
 */
function apachesolr_hook_info_alter(&$hooks) {
  // we can't do this in apachesolr_hook_info() until http://drupal.org/node/1415278 is fixed
  try {
    foreach (entity_get_info() as $entity_type => $info) {
      $hooks['apachesolr_index_document_build_' . $entity_type] = array(
        'group' => 'apachesolr',
      );
    }
  } catch (Exception $e) {

  }
}
pwolanin’s picture

Do we really need this code at all?

If we delete it the only downside is that these hooks are not declared to be part of the "group", which is not a well-used feature anyhow.

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new674 bytes
nick_vh’s picture

Status: Needs review » Reviewed & tested by the community

Normally hooks do not need to be explicitly defined. However, by declaring a hook explicitly, a module may define a "group" for it. Modules that implement a hook may then place their implementation in either $module.module or in $module.$group.inc. If the hook is located in $module.$group.inc, then that file will be automatically loaded when needed. In general, hooks that are rarely invoked and/or are very large should be placed in a separate include file, while hooks that are very short or very frequently called should be left in the main module file so that they are always available

We do not use the groups feature so I agree in removing it

nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
pwolanin’s picture

6.x has this, maybe doesn't need to be changed?


  $hooks['apachesolr_index_document_build'] = array(
    'group' => 'apachesolr',
  );
  $hooks['apachesolr_index_document_node_build'] = array(
    'group' => 'apachesolr',
  );
nick_vh’s picture

Status: Patch (to be ported) » Fixed

Right, closing this.

If this might be problematic for you in the D6, please reopen this issue

nick_vh’s picture

Status: Fixed » Closed (fixed)
basvredeling’s picture

Sorry I had to reopen this but the current hook_hook_info() implementation creates an error in the trigger module:

hooks = array(
    'apachesolr_field_mappings' => array(
      'group' => 'apachesolr',
    ),
    'apachesolr_field_mappings_alter' => array(
      'group' => 'apachesolr',
    ),
    'apachesolr_query_prepare' => array(
      'group' => 'apachesolr',
    ),
    'apachesolr_query_alter' => array(
      'group' => 'apachesolr',
    ),
    'apachesolr_search_result_alter' => array(
      'group' => 'apachesolr',
    ),
    'apachesolr_environment_delete' => array(
      'group' => 'apachesolr',
    )
  );

  $hooks['apachesolr_index_document_build'] = array(
    'group' => 'apachesolr',
  );
  $hooks['apachesolr_index_document_node_build'] = array(
    'group' => 'apachesolr',
  );

The $hooks content should be a multidimensional array. However, currently it returns a string. Which causes a foreach error in /modules/trigger/trigger.module line 173. The $ops tries to process a foreach loop on 'group', but group is a string.

basvredeling’s picture

Status: Closed (fixed) » Active

Forgot to reopen. I agree with comment #9. Let's not use groups in D6 and just remove it.

basvredeling’s picture

Same goes for facetapi, facetapi_hook_info() btw

nick_vh’s picture

Can you show us to the api page where it states that this is wrongly defined? Also, please provide us with a patch that removes the thing. Makes it easier for us to commit the change and test if it is ok :)

basvredeling’s picture

For hook_hook_info() please refer to both: http://drupal.org/node/375833 and http://api.drupal.org D6 hook_hook_info

Patch to remove hook_hook_info attached.

Same solution crossposted to facetapi issue list: #1701214: Remove backport of hook_hook_info()

nick_vh’s picture

Status: Active » Fixed

Committed to 6.x-3.x. Thanks!

Status: Fixed » Closed (fixed)

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