While debugging a failing unit test, I added some error logging which triggered the following Internal server error rather than logging anything:


An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=166&op=do StatusText: error ResponseText: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal-d7.simpletest616887simpletest' doesn't exist: INSERT INTO {simpletest} (test_id, test_class, status, message, message_group, function, line, file) 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); Array ( [:db_insert_placeholder_0] => 4 [:db_insert_placeholder_1] => DatabaseSelectTestCase [:db_insert_placeholder_2] => fail [:db_insert_placeholder_3] => [11-Feb-2014 16:18:15] array ( [:db_insert_placeholder_4] => Fatal error [:db_insert_placeholder_5] => Unknown [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => Unknown ) in DrupalTestCase::insertAssert() (line 210 of modules/simpletest/drupal_web_test_case.php).

The problem appears to be that simpletest_log_read is called while the test database is active, so an attempt is made to log the error into the simpletest table (which doesn't exist) in the test database, rather than the simpletest table (which does exist) in the parent Drupal database.

The attached patch moves the simpltest_log_read() call and the file_unmanaged_delete_recursive() call to after the main Drupal database is restored as the active database.

CommentFileSizeAuthor
simpletest_error_log.patch1.96 KBKevin Rogers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jooblay.net’s picture

Your views table as the error states in your mysql database missing. Which in turns means you corrupted the database and or drupal had a stroke at some point.

What is your status page memory limit?

The error 500 can be caused from 100s of things.

Kevin Rogers’s picture

Thanks for the help, but as I mentioned, the problem occurs while error logging when running some unit tests.

As I explained, the problem occurs because the test framework attempts to write an entry into the simpletest table which does not exist in the database used while actually running the tests.

Jooblay.net’s picture

Sorry I stand corrected good find:)

Version: 7.23 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.